Image encoding/decoding method and device, and recording medium storing bit stream

ABSTRACT

The present invention relates to an image encoding/decoding method and apparatus. The image decoding method according to the present invention may comprise configuring an MPM list based on intra-prediction modes of neighbor blocks of a current block and a number of frequencies of the intra-prediction modes of the neighbor blocks, deriving an intra-prediction mode of the current block based on the MPM list, and performing intra-prediction for the current block based on the intra-prediction mode.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a Continuation Application of U.S. patentapplication Ser. No. 16/496,581, filed on Sep. 23, 2019, which is a U.S.National Stage Application of International Application No.PCT/KR2018004900, tiled on Apr. 27, 2018, which claims the benefit under35 USC 119(a) and 365(b) of Korean Patent Application No.10-2017-0055147, filed on Apr. 28, 2017, in the Korean IntellectualProperty Office, the entire disclosure of which is incorporated hereinby reference for all purposes.

TECHNICAL FIELD

The present invention relates to a method and apparatus forencoding/decoding an image. Particularly, the present invention relatesto a method and apparatus for encoding/decoding an image using intraprediction and a recording medium storing a bitstream generated by animage encoding method/apparatus of the present invention.

BACKGROUND ART

Recently, demands for high-resolution and high-quality images such ashigh definition (HD) images and ultra high definition (UHD) images, haveincreased in various application fields. However, higher resolution andquality image data has increasing amounts of data in comparison withconventional image data. Therefore, when transmitting image data byusing a medium such as conventional wired and wireless broadbandnetworks, or when storing image data by using a conventional storagemedium, costs of transmitting and storing increase. In order to solvethese problems occurring with an increase in resolution and quality ofimage data, high-efficiency image encoding/decoding techniques arerequired for higher-resolution and higher-quality images.

Image compression technology includes various techniques, including: aninter-prediction technique of predicting a pixel value included in acurrent picture from a previous or subsequent picture of the currentpicture; an intra-prediction technique of predicting a pixel valueincluded in a current picture by using pixel information in the currentpicture; a transform and quantization technique for compressing energyof a residual signal; an entropy encoding technique of assigning a shortcode to a value with a high appearance frequency and assigning a longcode to a value with a low appearance frequency; etc. Image data may beeffectively compressed by using such image compression technology, andmay be transmitted or stored.

DISCLOSURE Technical Problem

An object of the present invention is to provide a method and apparatusfor encoding and decoding an image to enhance compression efficiency anda recording medium storing a bitstream generated by an image encodingmethod/apparatus of the present invention.

Another object of the present invention is to provide a method andapparatus for encoding and decoding an image using intra prediction toenhance compression efficiency and a recording medium storing abitstream generated by an image encoding method/apparatus of the presentinvention.

Another object of the present invention is to provide a method andapparatus for encoding and decoding an image for signaling an intraprediction mode efficiently and a recording medium storing a bitstreamgenerated by an image encoding method/apparatus of the presentinvention.

Technical Solution

A method of decoding an image according to the present invention,wherein the method is performed by an image decoding apparatus, themethod may comprise configuring an MPM list based on intra-predictionmodes of neighbor blocks of a current block and a number of frequenciesof the intra-prediction modes of the neighbor blocks, deriving anintra-prediction mode of the current block based on the MPM list, andperforming intra-prediction for the current block based on theintra-prediction mode.

In the method of decoding an image according to the present invention,the intra-prediction modes of the neighbor blocks may be added to theMPM list according to a predetermined order, and the predetermined ordermay be determined based on a size or form of the current block.

In the method of decoding an image according to the present invention,when the current block is a horizontally long non-square block, for thepredetermined order, among the neighbor blocks, a left side neighborblock adjacent to a left side of the current block may be prior than anupper side neighbor block that is adjacent to an upper side of thecurrent block, and when the current block is a vertically longnon-square block, for the predetermined order, the upper side neighborblock may be prior than the left side neighbor block.

In the method of decoding an image according to the present invention,the number of frequencies may be determined based on a size of acorresponding neighbor block.

In the method of decoding an image according to the present invention,when the neighbor block has a horizontal length of W and a verticallength of H, the number of frequencies may be W*H, W, or H.

In the method of decoding an image according to the present invention,when the current block is a horizontally long non-square block, ahorizontal mode may be preferentially added to the MPM list, and whenthe current block is a vertically long non-square block, a vertical modemay be preferentially added to the MPM list.

In the method of decoding an image according to the present invention,the intra-prediction modes stored in the MPM list may be re-arrangedbased on the number of frequencies.

In the method of decoding an image according to the present invention,may further comprise adding a non-angular mode at a position next tointra-prediction modes with number of frequencies being equal to orgreater than a predetermined threshold value.

In the method of decoding an image according to the present invention,when a number of angular modes is greater than a number of non-angularmodes among the intra-prediction modes of the neighbor blocks, theangular mode may be preferentially added to the MPM list.

In the method of decoding an image according to the present invention,may further comprise adding to the MPM list a mode obtained by adding apredetermined offset to an angular mode included in the MPM list.

A method of encoding an image according to the present invention,wherein the method is performed by an image encoding apparatus, themethod may comprise determining an intra-prediction mode of a currentblock, and performing intra-prediction for the current block based onthe determined intra-prediction mode, configuring an MPM list based onintra-prediction modes of neighbor blocks of the current block and anumber of frequencies of the intra-prediction modes of the neighborblocks, and encoding the intra-prediction mode of the current blockbased on the MPM list.

In the method of encoding an image according to the present invention,the intra-prediction modes of the neighbor blocks may be added to theMPM list according to a predetermined order, and the predetermined ordermay be determined based on a size or form of the current block.

In the method of encoding an image according to the present invention,when the current block is a horizontally long non-square block, for thepredetermined order, among the neighbor blocks, a left side neighborblock adjacent to a left side of the current block may be prior than anupper side neighbor block adjacent to an upper side of the currentblock, and when the current block is a vertically long non-square block,for the W predetermined order, the upper side neighbor block may beprior than the left side neighbor block.

In the method of encoding an image according to the present invention,the number of frequencies may be determined based on a size of acorresponding neighbor block.

In the method of encoding an image according to the present invention,when the neighbor block has a horizontal length of W and a verticallength of H, the number of frequencies may be W*H, W, or H.

In the method of encoding an image according to the present invention,the current block is a horizontally long non-square block, a horizontalmode may be preferentially added to the MPM list, and when the currentblock is a vertically long non-square block, a vertical mode may bepreferentially added to the MPM list.

In the method of encoding an image according to the present invention,the intra-prediction modes stored in the MPM list may be re-arrangedbased on the number of frequencies.

In the method of encoding an image according to the present invention,may further comprise adding a non-angular mode at a position next to theintra-prediction modes with the number of frequencies equal to orgreater than a predetermined threshold value.

In the method of encoding an image according to the present invention,when a number of angular modes is greater than a number of non-angularmodes among the intra-prediction modes of the neighbor blocks, theangular mode may be preferentially added to the MPM list.

A computer readable recording medium according to the present inventionW may store a bitstream generated by an image encoding method accordingto the present invention

Advantageous Effects

According to the present invention, an image encoding/decoding methodand apparatus of improved compression efficiency and a recording mediumstoring a bitstream generated by an image encoding method/apparatus ofthe present invention may be provided.

And, according to the present invention, an image encoding/decodingmethod and apparatus using intra prediction of improved compressionefficiency and a recording medium storing a bitstream generated by animage encoding method/apparatus of the present invention may beprovided.

And, according to the present invention, an image encoding/decodingmethod and apparatus for signaling an intra prediction mode efficientlyand a recording medium storing a bitstream generated by an imageencoding method/apparatus of the present invention may be provided.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing configurations of an encodingapparatus according to an embodiment of the present invention.

FIG. 2 is a block diagram showing configurations of a decoding apparatusaccording to an embodiment of the present invention.

FIG. 3 is a view schematically showing a partition structure of an imagewhen encoding and decoding the image.

FIG. 4 is a view showing an intra-prediction process.

FIG. 5 is a view illustrating a method of performing intra prediction ona current block according to an embodiment of the present invention.

FIG. 6 is a view showing a neighbor block of a current block.

FIG. 7 is a view showing an embodiment of initializing an MPM list of acurrent block.

FIG. 8 is a view showing a number of intra-prediction modes that areusable according to a block form.

FIG. 9 is a view showing an angle of an angular intra-prediction mode.

FIG. 10 is an exemplary view depicting neighbor reconstructed samplelines which may be used for intra prediction of a current block.

FIG. 11 is a view depicting an embodiment of constructing a referencesample for a sub-block included in a current block.

FIG. 12 is a view depicting a method for replacing an unavailablereconstructed sample, using an available reconstructed sample.

FIG. 13 is an exemplary view illustrating intra prediction according toshapes of a current block.

MODE FOR INVENTION

A variety of modifications may be made to the present invention andthere are various embodiments of the present invention, examples ofwhich will now be provided with reference to drawings and described indetail. However, the present invention is not limited thereto, althoughthe exemplary embodiments can be construed as including allmodifications, equivalents, or substitutes in a technical concept and atechnical scope of the present invention, The similar reference numeralsrefer to the same or similar functions in various aspects. In thedrawings, the shapes and dimensions of elements may be exaggerated forclarity. In the following detailed description of the present invention,references are made to the accompanying drawings that show, by way ofillustration, specific embodiments in which the invention may bepracticed. These embodiments are described in sufficient detail toenable those skilled in the art to implement the present disclosure. Itshould be understood that various embodiments of the present disclosure,although different, are not necessarily mutually exclusive. For example,specific features, structures, and characteristics described herein, inconnection with one embodiment, may be implemented within otherembodiments without departing from the spirit and scope of the presentdisclosure. In addition, it should be understood that the location orarrangement of individual elements within each disclosed embodiment maybe modified without departing from the spirit and scope of the presentdisclosure. The following detailed description is, therefore, not to betaken in a limiting sense, and the scope of the present disclosure isdefined only by the appended claims, appropriately interpreted, alongwith the full range of equivalents to what the claims claim.

Terms used in the specification, ‘second’, etc. can be used to describevarious components, but the components are not to be construed as beinglimited to the terms. The terms are only used to differentiate onecomponent from other components. For example, the “first” component maybe named the ‘second’ component without departing from the scope of thepresent invention, and the ‘second’ component may also be similarlynamed the ‘first’ component. The term ‘and/or’ includes a combination ofa plurality of items or any one of a plurality of terms.

It will be understood that when an element is simply referred to asbeing ‘connected to’ or ‘coupled to’ another element without being‘directly connected to’ or ‘directly coupled to’ another element in thepresent description, it may be ‘directly connected to’ or ‘directlycoupled to’ another element or be connected to or coupled to anotherelement, having the other element intervening therebetween, In contrast,it should be understood that when an element is referred to as being“directly coupled” or “directly connected” to another element, there areno intervening elements present.

Furthermore, constitutional parts shown in the embodiments of thepresent invention are independently shown so as to representcharacteristic functions different from each other. Thus, it does notmean that each constitutional part is constituted in a constitutionalunit of separated hardware or software. In other words, eachconstitutional part includes each of enumerated constitutional parts forconvenience. Thus, at least two constitutional parts of eachconstitutional part may be combined to form one constitutional part orone constitutional part may be divided into a plurality ofconstitutional parts to perform each function. The embodiment where eachconstitutional part is combined and the embodiment where oneconstitutional part is divided are also included in the scope of thepresent invention, if not departing from the essence of the presentinvention.

The terms used in the present specification are merely used to describeparticular embodiments, and are not intended to limit the presentinvention. An expression used in the singular encompasses the expressionof the plural, unless it has a clearly different meaning in the context.In the present specification, it is to be understood that terms such as“including”, “having”, etc. are intended to indicate the existence ofthe features, numbers, steps, actions, elements, parts, or combinationsthereof disclosed in the specification, and are not intended to precludethe possibility that one or more other features, numbers, steps,actions, elements, parts, or combinations thereof may exist or may beadded, In other words, when a specific element is referred to as being“included”, elements other than the corresponding element are notexcluded, but additional elements may be included in embodiments of thepresent invention or the scope of the present invention.

In addition, some of constituents may not be indispensable constituentsperforming essential functions of the present invention but be selectiveconstituents improving only performance thereof. The present inventionmay be implemented by W including only the indispensable constitutionalparts for implementing the essence of the present invention except theconstituents used in improving performance. The structure including onlythe indispensable constituents except the selective constituents used inimproving only performance is also included in the scope of the presentinvention.

Hereinafter, embodiments of the present invention will be described indetail with reference to the accompanying drawings. In describingexemplary embodiments of the present invention, well-known functions orconstructions will not be described in detail since they mayunnecessarily obscure the understanding of the present invention. Thesame constituent elements in the drawings are denoted by the samereference numerals, and a repeated description of the same elements willbe omitted.

Hereinafter, an image may mean a picture configuring a video, or maymean the video itself. For example, “encoding or decoding or both of animage” may mean “encoding or decoding or both of” a moving picture, andmay mean “encoding or decoding or both of one image among images of amoving picture.”

Hereinafter, terms “moving picture” and “video” may be used as the samemeaning and be replaced with each other.

Hereinafter, a target image may be an encoding target image which is atarget of encoding and/or a decoding target image which is a target ofdecoding. Also, a target image may be an input image inputted to anencoding apparatus, and an input image inputted to a decoding apparatus.Here, a target image may have the same meaning with the current image.

Hereinafter, terms “image”, “picture”, “frame” and “screen” may be usedas the same meaning and be replaced with each other.

Hereinafter, a target block may be an encoding target block which is atarget of encoding and/or a decoding target block which is a target ofdecoding. Also, a target block may be the current block which is atarget of current encoding and/or decoding.

For example, terms “target block” and “current block” may be used as thesame meaning and be replaced with each other.

Hereinafter, terms “block” and “unit” may be used as the same meaningand be replaced with each other. Or a “block” may represent a specificunit.

Hereinafter, terms “region” and “segment” may be replaced with eachother.

Hereinafter, a specific signal may be a signal representing a specificblock. For example, an original signal may be a signal representing atarget block. A prediction signal may be a signal representing aprediction block. A residual signal may be a signal representing aresidual block.

In embodiments, each of specific information, data, flag, index, elementand attribute, etc, may have a value. A value of information, data,flag, index, element and attribute equal to “0” may represent a logicalfalse or the first predefined value. In other words, a value “0”, afalse, a logical false and the first predefined value may be replacedwith each other. A value of information, data, flag, index, element andattribute equal to “1” may represent a logical true or the secondpredefined value. In other words, a value “1”, a true, a logical trueand the second predefined value may be replaced with each other.

When a variable i or j is used for representing a column, a row or anindex, a value of i may be an integer equal to or greater than 0, orequal to or greater than 1. That is, the column, the row, the index,etc. may be counted from 0 or may be counted from 1.

Description of Terms

Encoder: means an apparatus performing encoding. That is, means anencoding apparatus.

Decoder: means an apparatus performing decoding. That is, means andecoding apparatus.

Block: is an M×N array of a sample. Herein, M and N may mean positiveintegers, and the block may mean a sample array of a two-dimensionalform. The block may refer to a unit. A current block my mean an encodingtarget block that becomes a target when encoding, or a decoding targetblock that becomes a target when decoding. In addition, the currentblock may be at least one of an encode block, a prediction block, aresidual block, and a transform block.

Sample: is a basic unit constituting a block. It may be expressed as avalue from 0 to 2^(Bd)−1 according to a bit depth (Bd). In the presentinvention, the sample may be used as a meaning of a pixel. That is, asample, a pel, a pixel may have the same meaning with each other.

Unit: may refer to an encoding and decoding unit. When encoding anddecoding an image, the unit may be a region generated by partitioning asingle image. In addition, the unit may mean a subdivided unit when asingle image is partitioned into subdivided units during encoding ordecoding. That is, an image may be partitioned into a plurality ofunits. When encoding and decoding an image, a predetermined process foreach unit may be performed. A single unit may be partitioned intosub-units that have sizes smaller than the size of the unit. Dependingon functions, the unit may mean a block, a macroblock, a coding treeunit, a code tree block, a coding unit, a coding block), a predictionunit, a prediction block, a residual unit), a residual block, atransform unit. a transform block, etc. In addition, in order todistinguish a unit from a block, the unit may include a luma componentblock, a chroma component block associated with the luma componentblock, and a syntax element of each color component block, The unit mayhave various sizes and forms, and particularly, the form of the unit maybe a two-dimensional geometrical figure such as a square shape, arectangular shape, a trapezoid shape, a triangular shape, a pentagonalshape, etc. In addition, unit information may include at least one of aunit type indicating the coding unit, the prediction unit, the transformunit, etc., and a unit size, a unit depth, a sequence of encoding anddecoding of a unit, etc.

Coding Tree Unit: is configured with a single coding tree block of aluma component Y, and two coding tree blocks related to chromacomponents Cb and Cr. In addition, it may mean that including the blocksand a syntax element of each block. Each coding tree unit may bepartitioned by using at least one of a quad-tree partitioning method anda binary-tree partitioning method to configure a lower unit such ascoding unit, prediction unit, transform unit, etc. It may be used as aterm for designating a sample block that becomes a process unit whenencoding/decoding an image as an input image.

Coding Tree Block: may be used as a term for designating any one of a Ycoding tree block, Cb coding tree block, and Cr coding tree block,

Neighbor Block: may mean a block adjacent to a current block. The blockadjacent to the current block may mean a block that comes into contactwith a boundary of the current block, or a block positioned within apredetermined distance from the current block. The neighbor block maymean a block adjacent to a vertex of the current block. Herein, theblock adjacent to the vertex of the current block may mean a blockvertically adjacent to a neighbor block that is horizontally adjacent tothe current block, or a block horizontally adjacent to a neighbor blockthat is vertically adjacent to the current block.

Reconstructed Neighbor block: may mean a neighbor block adjacent to acurrent block and which has been already spatially/temporally encoded ordecoded.

Herein, the reconstructed neighbor block may mean a reconstructedneighbor unit. A reconstructed spatial neighbor block may be a blockwithin a current picture and which has been already reconstructedthrough encoding or decoding or both. A reconstructed temporal neighborblock is a block at a corresponding position as the current block of theW current picture within a reference image, or a neighbor block thereof.

Unit Depth: may mean a partitioned degree of a unit. In a treestructure, the highest node(Root Node) may correspond to the first unitwhich is not partitioned. Also, the highest node may have the leastdepth value. In this case, the highest node may have a depth of level 0.A node having a depth of level 1 may represent a unit generated bypartitioning once the first unit. A node having a depth of level 2 mayrepresent a unit generated by partitioning twice the first unit. A nodehaving a depth of level n may represent a unit generated by partitioningn-times the first unit. A Leaf Node may be the lowest node and a nodewhich cannot be partitioned further. A depth of a Leaf Node may be themaximum level. For example, a predefined value of the maximum level maybe 3. A depth of a root node may be the lowest and a depth of a leafnode may be the deepest. In addition, when a unit is expressed as a treestructure, a level in which a unit is present may mean a unit depth.

Bitstream: may mean a bitstream including encoding image information.

Parameter Set: corresponds to header information among a configurationwithin a bitstream. At least one of a video parameter set, a sequenceparameter set, a picture parameter set, and an adaptation parameter setmay be included in a parameter set In addition, a parameter set mayinclude a &ice header, and the header information,

Parsing: may mean determination of a value of a syntax element byperforming entropy decoding, or may mean the entropy decoding itself.

Symbol: may mean at least one of a syntax element, a coding parameter,and a transform coefficient value of an encoding/decoding target unit.In addition, the symbol may mean an entropy encoding target or anentropy decoding result,

Prediction Mode: may be information indicating a mode encoded/decodedwith intra prediction or a mode encoded/decoded with inter prediction.

Prediction Unit: may mean a basic unit when performing prediction suchas inter-prediction, intra-prediction, inter-compensation,intra-compensation, and motion compensation. A single prediction unitmay be partitioned into a plurality of partitions having a smaller size,or may be partitioned into a plurality of lower prediction units. Aplurality of partitions may be a basic unit in performing prediction orcompensation. A partition which is generated by dividing a predictionunit may also be a prediction unit.

Prediction Unit Partition: may mean a form obtained by partitioning aprediction unit.

Transform Unit: may mean a basic unit when performing encoding/decodingsuch as transform, inverse-transform, quantization, dequantization,transform coefficient encoding/decoding of a residual signal. A singletransform unit may be partitioned into a plurality of lower-leveltransform units having a smaller size. Here,transformation/inverse-transformation may comprise at least one amongthe first transformation/the first inverse-transformation and the secondtransformation/the second inverse-transformation.

Scaling: may mean a process of multiplying a quantized level by afactor. A transform coefficient may be generated by scaling a quantizedlevel. The scaling also may be referred to as dequantization.

Quantization Parameter: may mean a value used when generating aquantized level using a transform coefficient during quantization. Thequantization parameter also may mean a value used when generating atransform coefficient by scaling a quantized level duringdequantization. The quantization parameter may be a value mapped on aquantization step size.

Delta Quantization Parameter: may mean a difference value between a Wpredicted quantization parameter and a quantization parameter of anencoding/decoding target unit.

Scan: may mean a method of sequencing coefficients within a unit, ablock or a matrix. For example, changing a two-dimensional matrix ofcoefficients into a one-dimensional matrix may be referred to asscanning, and changing a one-dimensional matrix of coefficients into atwo-dimensional matrix may be referred to as scanning or inversescanning.

Transform Coefficient: may mean a coefficient value generated aftertransform is performed in an encoder. It may mean a coefficient valuegenerated after at least one of entropy decoding and dequantization isperformed in a decoder. A quantized level obtained by quantizing atransform coefficient or a residual signal, or a quantized transformcoefficient level also may fall within the meaning of the transformcoefficient.

Quantized Level: may mean a value generated by quantizing a transformcoefficient or a residual signal in an encoder. Alternatively, thequantized level may mean a value that is a dequantization target toundergo dequantization in a decoder. Similarly, a quantized transformcoefficient level that is a result of transform and quantization alsomay fall within the meaning of the quantized level.

Non-zero Transform Coefficient: may mean a transform coefficient havinga value other than zero, or a transform coefficient level or a quantizedlevel having a value other than zero.

Quantization Matrix: may mean a matrix used in a quantization process ora dequantization process performed to improve subjective or objectiveimage quality. The quantization matrix also may be referred to as ascaling list.

Quantization Matrix Coefficient: may mean each element within aquantization matrix. The quantization matrix coefficient also may bereferred to as a matrix coefficient.

Default Matrix: may mean a predetermined quantization matrixpreliminarily defined in an encoder or a decoder.

Non-default Matrix: may mean a quantization matrix that is notpreliminarily defined in an encoder or a decoder but is signaled by auser.

Statistic Value: a statistic value for at least one among a variable, anencoding parameter, a constant value, etc. which have a computablespecific value may be one or more among an average value, a weightedaverage value, a weighted sum value, the minimum value, the maximumvalue, the most frequent value, a median value, an interpolated value ofthe corresponding specific values.

FIG. 1 is a block diagram showing a configuration of an encodingapparatus according to an embodiment to which the present invention isapplied.

An encoding apparatus 100 may be an encoder, a video encoding apparatus,or an image encoding apparatus. A video may include at least one image.The encoding apparatus 100 may sequentially encode at least one image.

Referring to FIG. 1, the encoding apparatus 100 may include a motionprediction unit 111, a motion compensation unit 112, an intra-predictionunit 120, a switch 115, a subtractor 125, a transform unit 130, aquantization unit 140, an entropy encoding unit 150, a dequantizationunit 160, an inverse-transform unit 170, an adder 175, a filter unit180, and a reference picture buffer 190.

The encoding apparatus 100 may perform encoding of an input image byusing an intra mode or an inter mode or both. In addition, encodingapparatus 100 may generate a bitstream including encoded informationthrough encoding the input image, and output the generated bitstream.The generated bitstream may be stored in a computer readable recordingmedium, or may be streamed through a wired/wireless transmission medium.When an intra mode is used as a prediction mode, the switch 115 may beswitched to an intra. Alternatively, when an inter mode is used as aprediction mode, the switch 115 may be switched to an inter mode.Herein, the intra mode may mean an intra-prediction mode, and the intermode may mean an inter-prediction mode. The encoding apparatus 100 maygenerate a prediction block for an input block of the input image. Inaddition, the encoding apparatus 100 may encode a residual block using aresidual of the input block and the prediction block after theprediction block being generated. The input image may be called as acurrent image that is a current encoding target. The input block may becalled as a current block that is current encoding target, or as anencoding target block.

When a prediction mode is an intra mode, the intra-prediction unit 120may use a sample of a block that has been already encoded/decoded and isadjacent to a current block as a reference sample. The intra-predictionunit 120 may perform spatial prediction for the current block by using areference sample, or generate prediction samples of an input block byperforming spatial prediction. Herein, the intra prediction may meanintra-prediction.

When a prediction mode is an inter mode, the motion prediction unit 111may retrieve a region that best matches with an input block from areference image when performing motion prediction, and deduce a motionvector by using the retrieved region. In this case, a search region maybe used as the region. The reference image may be stored in thereference picture buffer 190. Here, when encoding/decoding for thereference image is performed, it may be stored in the reference picturebuffer 190.

The motion compensation unit 112 may generate a prediction block by Wperforming motion compensation for the current block using a motionvector. Herein, inter-prediction may mean inter-prediction or motioncompensation.

When the value of the motion vector is not an integer, the motionprediction unit 111 and the motion compensation unit 112 may generatethe prediction block by applying an interpolation filter to a partialregion of the reference picture. In order to perform i inter-pictureprediction or motion compensation on a coding unit, it may be determinedthat which mode among a skip mode, a merge mode, an advanced motionvector prediction (AMVP) mode, and a current picture referring mode isused for motion prediction and motion compensation of a prediction unitincluded in the corresponding coding unit. Then, inter-pictureprediction or motion compensation may be differently performed dependingon the determined mode.

The subtractor 125 may generate a residual block by using a residual ofan input block and a prediction block. The residual block may be calledas a residual signal. The residual signal may mean a difference betweenan original signal and a prediction signal. In addition, the residualsignal may be a signal generated by transforming or quantizing, ortransforming and quantizing a difference between the original signal andthe prediction signal. The residual block may be a residual signal of ablock unit.

The transform unit 130 may generate a transform coefficient byperforming transform of a residual block, and output the generatedtransform coefficient. Herein, the transform coefficient may be acoefficient value generated by performing transform of the residualblock. When a transform skip mode is applied, the transform unit 130 mayskip transform of the residual block.

A quantized level may be generated by applying quantization to thetransform coefficient or to the residual signal. Hereinafter, thequantized level may be also called as a transform coefficient inembodiments.

The quantization unit 140 may generate a quantized level by quantizingthe transform coefficient or the residual signal according to aparameter, and output the generated quantized level. Herein, thequantization unit 140 may quantize the transform coefficient by using aquantization matrix.

The entropy encoding unit 150 may generate a bitstream by performingentropy encoding according to a probability distribution on valuescalculated by the quantization unit 140 or on coding parameter valuescalculated when performing encoding, and output the generated bitstream.The entropy encoding unit 150 may perform entropy encoding of sampleinformation of an image and information for decoding an image. Forexample, the information for decoding the image may include a syntaxelement.

When entropy encoding is applied, symbols are represented so that asmaller number of bits are assigned to a symbol having a high chance ofbeing generated and a larger number of bits are assigned to a symbolhaving a low chance of being generated, and thus, the size of bit streamfor symbols to be encoded may be decreased. The entropy encoding unit150 may use an encoding method for entropy encoding such as exponentialGolomb, context-adaptive variable length coding (CAVLC),context-adaptive binary arithmetic coding (CABAC), etc. For example, theentropy encoding unit 150 may perform entropy encoding by using avariable length coding/code (VLC) table. In addition, the entropyencoding unit 150 may deduce a binarization method of a target symboland a probability model of a target symbol/bin, and perform arithmeticcoding by using the deduced binarization method, and a context model.

In order to encode a transform coefficient level(quantized level), theentropy encoding unit 150 may change a two-dimensional block formcoefficient into a one-dimensional vector form by using a transformcoefficient scanning method.

A coding parameter may include information (flag, index, etc.) such assyntax element that is encoded in an encoder and signaled to a decoder,and information derived when performing encoding or decoding. The codingparameter may mean information required when encoding or decoding animage. For example, at least one value or a combination form of aunit/block size, a unit/block depth, unit/block partition information,unit/block shape, unit/block partition structure, whether to partitionof a quad-tree form, whether to partition of a binary-tree form, apartition direction of a binary-tree form (horizontal direction orvertical direction), a partition form of a binary-tree form (symmetricpartition or asymmetric partition), a prediction mode(intra predictionor inter prediction), a ma intra-prediction mode/direction, a chromaintra-prediction mode/direction, intra partition information, interpartition information, a coding block partition flag, a prediction blockpartition flag, a transform block partition flag, a reference samplefiltering method, a reference sample filter tab, a reference samplefilter coefficient, a prediction block filtering method, a predictionblock filter tap, a prediction block filter coefficient, a predictionblock boundary filtering method, a prediction block boundary filter tab,a prediction block boundary filter coefficient, an intra-predictionmode, an inter-prediction mode, motion information, a motion vector, amotion vector difference, a reference picture index, a inter-predictionangle, an inter-prediction indicator, a prediction list utilizationflag, a reference picture list, a reference picture, a motion vectorpredictor index, a motion vector predictor candidate, a motion vectorcandidate list, whether to use a merge mode, a merge index, a mergecandidate, a merge candidate list, whether to use a skip mode, aninterpolation filter type, an interpolation filter tab, an interpolationfilter coefficient, a motion vector size, a presentation accuracy of amotion vector, a transform type, a transform size, information ofwhether or not a primary(first) transform is used, information ofwhether or not a secondary transform is used, a primary transform index,a secondary transform index, information of whether or not it) aresidual signal is present, a coded block pattern, a coded blockflag(CBF), a quantization parameter, a quantization parameter residue, aquantization matrix, whether to apply an intra loop filter, an intraloop filter coefficient, an intra loop filter tab, an intra loop filtershape/form, whether to apply a deblocking filter, a deblocking filtercoefficient, a deblocking filter tab, a deblocking filter strength, adeblocking filter shape/form, whether to apply an adaptive sampleoffset, an adaptive sample offset value, an adaptive sample offsetcategory, an adaptive sample offset type, whether to apply an adaptiveloop filter, an adaptive loop filter coefficient, an adaptive loopfilter tab, an adaptive loop filter shape/form, abinarization/inverse-binarization method, a context model determiningmethod, a context model updating method, whether to perform a regularmode, whether to perform a bypass mode, a context bin, a bypass bin, asignificant coefficient flag, a last significant coefficient flag, acoded flag for a unit of a coefficient group, a position of the lastsignificant coefficient, a flag for whether a value of a coefficient islarger than 1, a flag for whether a value of a coefficient is largerthan 2, a flag for whether a value of a coefficient is larger than 3,information on a remaining coefficient value, a sign information, areconstructed luma sample, a reconstructed chroma sample, a residualluma sample, a residual chroma sample, a lura transform coefficient, achroma transform coefficient, a quantized lura level, a quantized chromalevel, a transform coefficient level scanning method, a size of a motionvector search area at a decoder side, a shape of a motion vector searcharea at a decoder side, a number of time of a motion vector search at adecoder side, information on a CTU size, information on a minimum blocksize, information on a maximum block size, information on a maximumblock depth, information on a minimum block depth, an imagedisplaying/outputting sequence, slice identification information, aslice type, slice partition information, the identification information,a tile type, tile partition information, a picture type, a bit depth ofan input sample, a bit depth of a reconstruction sample, a bit depth ofa residual sample, a bit depth of a transform coefficient, a bit depthof a quantized level, and information on a lama signal or information ona chroma signal may be included in the coding parameter.

Herein, signaling the flag or index may mean that a corresponding flagor index is entropy encoded and included in a bitstream by an encoder,and may mean that the i corresponding flag or index is entropy decodedfrom a bitstream by a decoder.

When the encoding apparatus 100 performs encoding throughinter-prediction, an encoded current image may be used as a referenceimage for another image that is processed afterwards. Accordingly, theencoding apparatus 100 may reconstruct or decode the encoded currentimage, or store the reconstructed or decoded image as a reference imagein reference picture buffer 190.

A quantized level may be dequantized in the dequantization unit 160, ormay be inverse-transformed in the inverse-transform unit 170. Adequantized or inverse-transformed coefficient or both may be added witha prediction block by the adder 175. By adding the dequantized orinverse-transformed coefficient or both with the prediction block, areconstructed block may be generated. Herein, the dequantized orinverse-transformed coefficient or both may mean a coefficient on whichat least one of dequantization and inverse-transform is performed, andmay mean a reconstructed residual block.

A reconstructed block may pass through the filter unit 180. The filterunit 180 may apply at least one of a deblocking filter, a sampleadaptive offset (SAO), and an adaptive loop filter (ALF) to areconstructed sample, a reconstructed block or a reconstructed image.The filter unit 180 may be called as an in-loop filter.

The deblocking filter may remove block distortion generated inboundaries between blocks. In order to determine whether or not to applya deblocking filter, whether or not to apply a deblocking filter to acurrent block may be determined based samples W included in several rowsor columns which are included in the block, When a deblocking filter isapplied to a block, another filter may be applied according to arequired deblocking filtering strength.

In order to compensate an encoding error, a proper offset value may beadded to a sample value by using a sample adaptive offset. The sampleadaptive offset may correct an offset of a deblocked image from anoriginal image by a sample unit. A method of partitioning samples of animage into a predetermined number of regions, determining a region towhich an offset is applied, and applying the offset to the determinedregion, or a method of applying an offset in consideration of edgeinformation on each sample may be used.

The adaptive loop filter may perform filtering based on a comparisonresult of the filtered reconstructed image and the original image.Samples included in an image may be partitioned into predeterminedgroups, a filter to be applied to each group may be determined, anddifferential filtering may be performed for each group. Information ofwhether or not to apply the ALF may be signaled by coding units (CUs),and a form and coefficient of the ALF to be applied to each block mayvary,

The reconstructed block or the reconstructed image having passed throughthe filter unit 180 may be stored in the reference picture buffer 190. Areconstructed block processed by the filter unit 180 may be a part of areference image. That is, a reference image is a reconstructed imagecomposed of reconstructed blocks processed by the filter unit 180. Thestored reference Image may be used later in inter prediction or motioncompensation.

FIG. 2 is a block diagram showing a configuration of a decodingapparatus according to an embodiment and to which the present inventionis applied.

A decoding apparatus 200 may a decoder, a video decoding apparatus, oran image decoding apparatus.

Referring to FIG. 2, the decoding apparatus 200 may include an entropydecoding unit 210, a dequantization unit 220, a inverse-transform unit230, an intra-prediction unit 240, a motion compensation unit 250, anadder 225, a filter unit 260, and a reference picture buffer 270.

The decoding apparatus 200 may receive a bitstream output from theencoding apparatus 100. The decoding apparatus 200 may receive abitstream stored in a computer readable recording medium, or may receivea bitstream that is streamed through a wired/wireless transmissionmedium. The decoding apparatus 200 may decode the bitstream by using anintra mode or an inter mode. In addition, the decoding apparatus 200 maygenerate a reconstructed image generated through decoding or a decodedimage, and output the reconstructed image or decoded image.

When a prediction mode used when decoding is an intra mode, a switch maybe switched to an intra. Alternatively, when a prediction mode used whendecoding is an inter mode, a switch may be switched to an inter mode.

The decoding apparatus 200 may obtain a reconstructed residual block bydecoding the input bitstream, and generate a prediction block. When thereconstructed residual block and the prediction block are obtained, thedecoding apparatus 200 may generate a reconstructed block that becomes adecoding target by adding the reconstructed residual block with theprediction block. The decoding target block may be called a currentblock.

The entropy decoding unit 210 may generate symbols by entropy decodingthe bitstream according to a probability distribution. The generatedsymbols may include a symbol of a quantized level form. Herein, anentropy decoding method may be a inverse-process of the entropy encodingmethod described above.

In order to decode a transform coefficient level(quantized level), theentropy decoding unit 210 may change a one-directional vector formcoefficient into a two-dimensional block form by using a transformcoefficient scanning method.

A quantized level may be dequantized in the dequantization unit 220, orinverse-transformed in the inverse-transform unit 230. The quantizedlevel may be a result of dequantizing or inverse-transforming or both,and may be generated as a reconstructed residual block. Herein, thedequantization unit 220 may apply a quantization matrix to the quantizedlevel.

When an intra mode is used, the intra-prediction unit 240 may generate aprediction block by performing, for the current block, spatialprediction that uses a sample value of a block adjacent to a decodingtarget block and which has been already decoded.

When an inter mode is used, the motion compensation unit 250 maygenerate a prediction block by performing, for the current block, motioncompensation that uses a motion vector and a reference image stored inthe reference picture buffer 270.

The adder 225 may generate a reconstructed block by adding thereconstructed residual block with the prediction block. The filter unit260 may apply at least one of a deblocking filter, a sample adaptiveoffset, and an adaptive loop filter to the reconstructed block orreconstructed image. The filter unit 260 may output the reconstructedimage. The reconstructed block or reconstructed image may be stored inthe reference picture buffer 270 and used when performinginter-prediction. A reconstructed block processed by the filter unit 260may be a part of a reference image. That is, a reference image is areconstructed image composed of reconstructed blocks processed by thefilter unit 260, The stored reference image may be used later in interprediction or motion W compensation.

FIG. 3 is a view schematically showing a partition structure of an imagewhen encoding and decoding the image. FIG. 3 schematically shows anexample of partitioning a single unit into a plurality of lower units.

In order to efficiently partition an image, when encoding and decoding,a coding unit (CU) may be used. The coding unit may be used as a basicunit when encoding/decoding the image. In addition, the coding unit maybe used as a unit for distinguishing an intra prediction mode and aninter prediction mode when encoding/decoding the image. The coding unitmay be a basic unit used for prediction, transform, quantization,inverse-transform, dequantization, or an encoding/decoding process of atransform coefficient,

Referring to FIG. 3, an image 300 is sequentially partitioned in alargest coding unit (LOU), and a LCU unit is determined as a partitionstructure, Herein, the LOU may be used in the same meaning as a codingtree unit (CTU), A unit partitioning may mean partitioning a blockassociated with to the unit. In block partition information, informationof a unit depth may be included. Depth information may represent anumber of times or a degree or both in which a unit is partitioned. Asingle unit may be partitioned into a plurality of lower level unitshierarchically associated with depth information based on a treestructure. In other words, a unit and a lower level unit generated bypartitioning the unit may correspond to a node and a child node of thenode, respectively. Each of partitioned lower unit may have depthinformation. Depth information may be information representing a size ofa CU, and may be stored in each CU. Unit depth represents times and/ordegrees related to partitioning a unit. Therefore, partitioninginformation of a lower-level unit may comprise information on a size ofthe lower-level unit.

A partition structure may mean a distribution of a coding unit (CU)within an LOU 310. Such a distribution may be determined according towhether or not to partition a single CU into a plurality (positiveinteger equal to or greater than 2 including 2, 4, 8, 16, etc.) of CUs Ahorizontal size and a vertical size of the CU generated by partitioningmay respectively be half of a horizontal size and a vertical size of theCU before partitioning, or may respectively have sizes smaller than ahorizontal size and a vertical size before partitioning according to anumber of times of partitioning. The CU may be recursively partitionedinto a plurality of CUs. By the recursive partitioning, at least oneamong a height and a width of a CU after partitioning may decreasecomparing with at least one among a height and a width of a CU beforepartitioning. Partitioning of the CU may be recursively performed untilto a predefined depth or predefined size. For example, a depth of an LOUmay be 0, and a depth of a smallest coding unit (SCU) may be apredefined maximum depth. Herein, the LCU may be a coding unit having amaximum coding unit size, and the SCU may be a coding unit having aminimum coding unit size as described above. Partitioning is startedfrom the LCU 310, a CU depth increases by 1 as a horizontal size or avertical size or both of the CU decreases by partitioning. For example,for each depth, a CU which is not partitioned may have a size of 2Nx2N.Also, in case of a CU which is partitioned, a CU with a size of 2Nx2Nmay be partitioned into four CUs with a size of NxN. A size of N maydecrease to half as a depth increase by 1.

In addition, information whether or not the CU is partitioned may berepresented by using partition information of the CU. The partitioninformation may be 1-bit information. All CUs, except for a SCU, mayinclude partition information. For example, when a value of partitioninformation is the first value, the CU may not be partitioned, when avalue of partition information is the second value, the CU may bepartitioned.

Referring to FIG. 3, an LCU having a depth 0 may be a 64×64 block. 0 maybe a minimum depth. A SCU having a depth 3 may be an 8×8 block. 3 may bea maximum depth. A CU of a 32×32 block and a 16×16 block may berespectively represented as a depth 1 and a depth 2.

For example, when a single coding unit is partitioned into four codingunits, a horizontal size and a vertical size of the four partitionedcoding units may be a half size of a horizontal and vertical size of theCU before being partitioned. In one embodiment, when a coding unithaving a 32×32 size is partitioned into four coding units, each of thefour partitioned coding units may have a 16×16 size. When a singlecoding unit is partitioned into four coding units, it may be called thatthe coding unit may be partitioned into a quad-tree form.

For example, when a single coding unit is partitioned into two codingunits, a horizontal or vertical size of the two coding units may be ahalf of a horizontal or vertical size of the coding unit before beingpartitioned. For example, when a coding unit having a 32×32 size ispartitioned in a vertical direction, each of two partitioned codingunits may have a size of 16×32. When a single coding unit is partitionedinto two coding units, it may be called that the coding unit ispartitioned in a binary-tree form. An LCU 320 of FIG. 3 is an example ofan LCU to which both of partitioning of a quad-tree form andpartitioning of a binary-tree form are applied.

FIG. 4 is a view showing an intra-prediction process.

Arrows from center to outside in FIG. 4 may represent predictiondirections of intra prediction modes.

Intra encoding and/or decoding may be performed by using a referencesample of a neighbor block of the current block. A neighbor block may bea reconstructed neighbor block, For example, intra encoding and/ordecoding may be performed by using an encoding parameter or a value of areference sample included in a reconstructed neighbor block.

A prediction block may mean a block generated by performing intraprediction. A prediction block may correspond to at least one among CU,PU and TU. A unit of a prediction block may have a size of one among CU,PU and TU. A prediction block may be a square block having a size of2×2, 4×4, 16×16, 32×32 or 64×64 etc. or may be a rectangular blockhaving a size of 2×8, 4×8, 2×16, 4×16 and 8×16 etc.

Intra prediction may be performed according to intra prediction mode forthe current block. The number of intra prediction modes which thecurrent block may have may be a fixed value and may be a valuedetermined differently according to an attribute of a prediction block.For example, an attribute of a prediction block may comprise a size of aprediction block and a shape of a prediction block, etc.

The number of intra-prediction modes may be fixed to N regardless of ablock size. Or, the number of intra prediction modes may be 3, 5, 9, 17,34. 35, 36, 65, or 67 etc. Alternatively, the number of intra-predictionmodes may vary according to a block size or a color component type orboth. For example, the number of intra prediction modes may varyaccording to whether the color component is a luma signal or a chromasignal. For example, as a block size becomes large, a number ofintra-prediction modes may increase. Alternatively, a number ofintra-prediction modes of a lura component block may be larger than anumber of intra-prediction modes of a chroma component block.

An intra-prediction mode may be a non-angular mode or an angular mode,The non-angular mode may be a DC mode or a planar mode, and the angularmode may be a prediction mode having a specific direction or angle. Theintra-prediction mode may be expressed by at least one of a mode number,a mode value, a mode numeral, a mode angle, and mode direction. A numberof intra-prediction modes may be M, which is larger than 1, includingthe non-angular and the angular mode.

In order to intra-predict a current block, a step of determining whetheror not samples included in a reconstructed neighbor block may be used asreference samples of the current block may be performed. When a samplethat is not usable as a reference sample of the current block ispresent, a value obtained by duplicating or performing interpolation onat least one sample value among samples included in the reconstructedneighbor block or both may be used to replace with a non-usable samplevalue of a sample, thus the replaced sample value is used as a referencesample of the current block.

When intra-predicting, a filter may be applied to at least one of areference sample and a prediction sample based on an intra-predictionmode and a current block size,

In case of a planar mode, when generating a prediction block of acurrent block, according to a position of a prediction target samplewithin a prediction block, a sample value of the prediction targetsample may be generated by using a weighted sum of an upper and leftside reference sample of a current sample, and a right upper side andleft lower side reference sample of the current block. In addition, incase of a DC mode, when generating a prediction block of a currentblock, an average value of upper side and left side reference samples ofthe current block may be used. In addition, in case of an angular mode,a prediction block may be generated by using an upper side, a left side,a right upper side, and/or a left lower side reference sample of thecurrent block. In order to generate a prediction sample value,interpolation of a real number unit may be performed.

An intra-prediction mode of a current block may be entropyencoded/decoded by predicting an intra-prediction mode of a blockpresent adjacent to the current block, When intra-prediction modes ofthe current block and the neighbor block are identical, information thatthe intra-prediction modes of the current block and the neighbor blockare identical may be signaled by using predetermined flag information.In addition, indicator information of an intra-prediction mode that isidentical to the intra-prediction mode of the current block amongintra-prediction modes of a plurality of neighbor blocks may besignaled. When intra-prediction modes of the current block and theneighbor block are different, intra-prediction mode information of thecurrent block may be entropy encoded/decoded by performing entropyencoding/decoding based on the intra-prediction mode of the neighborblock.

FIG. 5 is a view illustrating a method of performing intra prediction ona current block according to an embodiment of the present invention.

As shown in FIG. 5, intra prediction may include an intra-predictionmode inducement step S510, a reference sample configuration step S520and/or an intra-prediction execution step S530.

At the intra-prediction mode inducement step S510, the intra-predictionmode of the current block may be induced using at least one of a methodof using an intra-prediction mode of a neighbor block, a method ofdecoding the intra-prediction mode of the current block (e.g., entropydecoding), a method of using an intra-prediction mode of a colorcomponent, a method of using an intra-prediction mode using a transformmodel, a method of using information on a size and/or a shape of thecurrent block and a method of using a predetermined intra predictionmode indicator.

In the method of using the intra-prediction mode of the neighbor block,the intra-prediction mode of the current block may be induced by usingat least one of the intra-prediction mode of the neighbor block, acombination of one or more intra-prediction modes of the neighbor block,and/or an intra-prediction mode induced by using MPM lists.

When using MPM lists, intra prediction mode of the current block may beencoded/decoded using at least one among an MPM list of the currentblock, an MPM list of the upper-layer block and an MPM list of theneighbor block.

An MPM list may be constructed based on at least one among intraprediction mode information of adjacent blocks and frequency of intraprediction modes of adjacent blocks.

At the reference sample configuration step S520, a reference sampleselection step and/or a reference sample filtering step may be performedsuch that a reference sample may be configured.

At the intra prediction execution step S530, at least one method ofnon-directionality prediction, directionality prediction,location-information-based prediction and/or prediction between colorcomponents is used to perform intra prediction of the current block. Atthe intra prediction execution step S530, filtering for a predictionsample may be executed.

Hereinafter, the intra-prediction mode inducement step S510 will bedescribed in detail.

A neighbor block of the current block may be at least one of lower left,left, upper left, upper, and upper right neighbor blocks of the currentblock, Among the neighbor blocks, only neighbor blocks that can use theintra-prediction mode may be used.

Among the neighbor blocks of the current block, an intra-prediction modeof a neighbor block at a particular position may be induced as theintra-prediction mode of the current block.

Alternatively, two or more neighbor blocks are selected, a statisticvalue of intra-prediction modes of the selected neighbor blocks may beinduced as the intra-prediction mode of the current block. Theintra-prediction mode may be indicated by at least one of a mode number,a mode value, and a mode angle. In the description, the statistic valuemay be at least one of a minimum value, a maximum value, an averagevalue, a weighted average value, a mode, and a median value.

The neighbor block at the particular position and/or the selectedneighbor blocks may be a block(s) at a predefined fixed position.Alternatively, the block(s) may be specified based on informationsignaled through a bitstream.

When using at least two intra-prediction modes, whether theintra-prediction mode has directionality or non-directionality may beconsidered. For example, among two or more intra-prediction modes, theintra-prediction mode of the current block may be induced using adirectional intra-prediction mode. Alternatively, the intra-predictionmode of the current block may be induced using a non-directionalintra-prediction mode.

When the weighted average value is used as the statistic value, arelatively high weight may be assigned to a particular intra-predictionmode. The particular intra-prediction mode may be at least one of, forexample, a vertical mode, a horizontal mode, a diagonal mode, anon-directionality mode. Alternatively, information on the particularintra-prediction mode may be signaled through a bitstream. Respectiveweights of particular intra-prediction modes may be equal to ordifferent from each other. Alternatively, the weight may be determinedbased on a size of a neighbor block. For example, a relatively highweight may be assigned to an intra-prediction mode of a relatively largeneighbor block.

The intra-prediction mode of the current block may be induced using anMPM (Most Probable Mode).

When using the MPM, an MPM list may be configured using Nintra-prediction modes induced using the intra-prediction mode of theneighbor block. N is a positive integer, and may have a value thatdiffers depending on a size and/or a shape of the current block,Alternatively, information on N may be signaled through a bitstream.

Intra-prediction modes that may be included in the MPM list may beintra-prediction modes of lower left, left, upper left, upper and/orupper right neighbor blocks of the current block. Also, thenon-directionality mode may be included in the MPM list. The Wintra-prediction modes may be included in the MPM list in apredetermined order. The predetermined order may be, for example, anorder of a mode of a lower left block, a mode of an upper block, aPlanar mode, a DC mode, a mode of a lower left block, a mode of an upperright block, and a mode of an upper left block. Alternatively, thepredetermined order may be an order of a mode of a left block, a mode ofan upper block, a Planar mode, a DC mode, a mode of a lower left block,a mode of an upper right block, and a mode of an upper left block.

The MPM list may be configured to not include a duplicate mode. When thenumber of intra-prediction modes included in the MPM list is less thanN, an additional intra-prediction mode may be included in the MPM list.The additional intra-prediction mode may be a mode corresponding to +k,−k of the directional intra-prediction mode included in the MPM list. Aninteger equal to or greater than one may be designated by k,Alternatively, at least one of a horizontal mode, a vertical mode, and adiagonal mode (a 45-degree angle mode, a 135-degree angle mode, and a225-degree angle mode) may be included in the MPM list. Alternatively, astatistic value of at least one intra-prediction mode of the neighborblock may be used to induce an intra-prediction mode to be included inthe MPM list.

There may be several MPM lists, and several MPM lists may be configuredin different methods. The intra-prediction mode included in each MPMlist may not be duplicated.

Information (e.g., flag information) indicating whether theintra-prediction mode of the current block is included in the MPM listmay be signaled through a bitstream. When there are N MPM lists, Npieces of flag information may exist. Determining whether theintra-prediction mode of the current block exits in the MPM list may beperformed in order for N MPM lists. Alternatively, informationindicating a MPM list including the intra-prediction mode of the currentblock, among N MPM lists may be signaled.

When the intra-prediction mode of the current block is included in theMPM list, index information for specifying which mode, among modesincluded in the MPM list, may be signaled through a bitstrearmAlternatively, a mode at a particular position (e.g., the first) of theMPM list may be induced as the intra-prediction mode of the currentblock.

In configuring the MPM list, one MPM list may be configured for apredetermined-size block. When the predetermined-size block ispartitioned into several sub-blocks, each of the several sub-blocks mayuse the configured MPM list.

Alternatively, the intra-prediction mode of the current block may beinduced using at least one of the intra-prediction mode of the currentblock induced using the MPM and the intra-prediction mode of theneighbor block.

For example, when the intra-prediction mode of the current block inducedusing the MPM is Pred_mpm, the Pred_mpm is changed into a predeterminedmode by using at least one intra-prediction mode of the neighbor blocksuch that the intra-prediction mode of the current block may be induced.For example, the Pred_mpm may be increased or decreased by N by beingcompared with the size of the intra-prediction mode of the neighborblock. Here, N may be a predetermined integer, such as. +1, +2, 0, −1,−2, −3, etc.

Alternatively, when one of the Pred_mpm and a mode of the neighbor blockis the non-directionality mode and the other one is the directionalitymode, the non-directionality mode may be induced as the intra-predictionmode of the current block or the directionality mode may be induced asthe intra-prediction mode of the current block.

In the case where the intra prediction mode of a current block isderived using a Most Probable Mode (MPM) list, for example, at least oneof the following MPM lists may be used. Or the intra prediction mode ofthe current block may be entropy-encoded/decoded.

An MPM list fora current block.

At least one of MPM lists for upper-layer blocks of a current block.

At least one of MPM lists for neighbor blocks of a current block.

Information required to make an MPM list, such as whether the MPM listof the current block is used, whether at least one of the MPM lists ofthe upper-layer blocks of the current block is used, and whether atleast one of the MPM lists of the neighbor blocks of the current blockis used, may be entropy-encoded/decoded in at least one of a videoparameter set (VPS), a sequence parameter set (SPS), a picture parameterset (PPS), an adaptation parameter set (APS), a slice, a header, a tile,a CTU, a CU, a PU, and a TU.

An upper-layer block may be a block having a smaller depth value thanthe current block. In addition, the upper-layer block may refer to atleast one of blocks including the current block among blocks having thesmaller depth values. Herein, a depth value may mean a value that isincreased by 1 each time a block is divided. For example, the depthvalue of an undivided CTU may be 0.

A neighbor block may be at least one of blocks which are spatiallyand/or temporally neighboring to the current block, The neighbor blocksmay have already been encoded/decoded, In addition, the neighbor blockmay have a depth (or size) equal to or different from that of thecurrent block. The neighbor block may refer to a block at apredetermined position with respect to the current block. Herein, thepredetermined position may be at least one of top left, top, top right,left, and bottom left positions with respect to the current block.

Or the predetermined position may be a position within a picturedifferent from a picture to which the current block belongs. A block atthe predetermined position may refer to at least one of a collocatedblock of the current block in the different picture and/or a blockneighboring to the collocated block. Or the block at the predeterminedposition may be a block having the same prediction mode as that of thecurrent block in a specific area of the different picture, correspondingto the current block.

The MPM list of the upper-layer block or the neighbor block may refer toan MPM list made based on the upper-layer block or the neighbor block.The intra prediction mode of an encoded/decoded block neighboring to theupper-layer block or the neighbor block may be added to the MPM list ofthe upper-layer block or the neighbor block.

The intra prediction mode of the current block may be derived orentropy-encoded/decoded, using N MPM lists. Herein, N may be 0 or apositive integer. That is, the intra prediction mode of the currentblock may be derived or entropy-encoded/decoded, using a plurality ofMPM lists. In addition, a plurality of MPM lists may refer to multipleMPM lists or multiple lists. N MPM lists for the current block mayinclude at least one of an MPM list of the current block, an MPM list ofan upper-layer block, and an MPM list of a neighbor block.

Further, the N MPM lists may be generated, using at least one of codingparameters for the current block.

The intra prediction mode of the current block may be derived using themade MPM list, or entropy-encoded/decoded.

The plurality of MPM lists for the current block may include MPM listsfor N upper-layer blocks. Herein, N is 0 or a positive integer.

Information such as the number, depths, and/or depth ranges ofupper-layer blocks, and/or the differences between the depth of thecurrent block and the depths of the upper-layer blocks may be requiredin making an MPM list for an upper-layer block. The information requiredto make the MPM list of the upper-layer block may beentropy-encoded/decoded in at least one of a VPS, an SPS, a PPS, an APS,a slice header, a tile header, a CTU, a CU, a PU, and a TU.

If a plurality of MPM lists for the current block include MPM lists ofupper-layer blocks, the number and/or depth values of the usedupper-layer blocks may be derived using information about the sizeand/or depth of the current block.

The plurality of MPM lists for the current block may include MPM listsfor N neighbor blocks. The N neighbor blocks may include neighbor blocksat predetermined positions. N may be 0 or a positive integer.

Information such as the number N, depth values, sizes, and/or positionof the included neighbor blocks may be required to make an MPM list of aneighbor block. The information required to make an MPM list of aneighbor block may be entropy-encoded/decoded in at least one of a VPS,an SPS, a PPS, an APS, a slice header, a tile header, a CTU, a CU, a PU,and a TU. The number and/or positions of the neighbor blocks may bedetermined variably according to the size, shape, and/or position of thecurrent block. An MPM list of a neighbor block may be made, if the depthvalue of the neighbor block is a predetermined value or falls within apredetermined range. The predetermined range may be defined by at leastone of a minimum value or a maximum value. Information about the atleast one of the minimum value or the maximum value may beentropy-encoded/decoded in the afore-described predetermined unit.

An intra prediction mode derived based on at least one of the currentblock, the upper-layer block, and the neighbor block may be included inone MPM list for the current block. That is, if not a plurality of MPMlists but a single MPM list is used for the current block, the MPM listmay be made up of at least one of intra prediction modes derived basedon at least one of intra prediction modes based on at least one of thecurrent block, the upper-layer block, and the neighbor block.

If N MPM lists for the current block include an MPM list for at leastone of upper-layer blocks and neighbor block, the order of making the NMPM lists may be determined. Herein, N may be 0 or a positive integer.

The order of making the MPM lists may be preset in the encoder and thedecoder. Or, the order of making the MPM lists may be determined basedon a coding parameter of each corresponding block. Or, the order ofmaking the MPM lists may be determined based on a coding parameter ofthe current block. Or, information about the order of making the MPMlists may be entropy-encoded/decoded.

For example, with an MPM list of the current block used as the first MPMlist, a plurality of MPM lists may be made for current block, using MPMlists for at least K upper-layer blocks arranged in an ascending ordescending order of depth values. For example, with an MPM list of thecurrent block used as the first MPM list, a plurality of MPM lists maybe made for current block, using MPM lists for at least one of top left,left, bottom left, top, and top right neighbor blocks in a predeterminedorder.

For example, a plurality of MPM lists may be made for current block inthe order of an MPM list of the current block→MPM lists for Kupper-layer blocks in a predetermined order→MPM lists for L neighborblocks in a predetermined order. Or, a plurality of MPM lists may bemade for current block in the order of an MPM list of the currentblock→MPM lists for L neighbor blocks in a predetermined order→MPM listsfor K upper-layer blocks in a predetermined order. Herein, each of K andL may be 0 or a positive integer.

A following MPM list may not include intra prediction modes of apreceding MPM list in the order. In addition, the variable length codeof an indicator for the preceding MPM list may be shorter than thevariable length code of an indicator for the following MPM list. Inaddition, the preceding MPM list may include a smaller number ofcandidates than the following MPM list. Indicators may be allocated tothe MPM lists in the order of making the MPM lists.

The redundancy check on the modes included in the MPM lists may beperformed in the step of making a plurality of MPM lists. Or, theredundancy check may be performed after all of a plurality of MPM listsare made. Or, the redundancy check may be performed each time an intraprediction mode is included in an MPM list

The predetermined intra prediction modes added to substitute forredundant prediction modes may include at least one of intra predictionmodes including, for example, INTRA_PLANAR, INTRA_DC, horizontal mode,vertical mode, 45-degree mode, 135-degree mode, 225-degree mode,MPM_LIST_K_MODE_X±delta, INTRA_DM, and INTRA_LM. Here, MPM_LIST_K_MODEXmay refer to a predetermined intra prediction mode included in the K-thMPM list. INTRA_DM may refer to an intra prediction mode in which anintra chroma prediction mode is determined to be identical to an intralama prediction mode. In addition, INTRA_LM may refer to an intraprediction mode in which at least one of a chromaprediction/residual/reconstruction block is generated based on at leastone of a luma prediction/residual/reconstruction block. In addition,delta may be a positive integer.

If the intra prediction mode of the current block is derived using N MPMlists or the intra prediction mode of the current block isentropy-encoded/decoded, an indicator (MPM flag) indicating whether theintra prediction mode of the current block is included among the intraprediction modes of each of the N MPM lists may beentropy-encoded/decoded, for each of the N MPM lists.

In the presence of the same intra prediction mode as the intraprediction W mode of the current block among the intra prediction modesincluded in a specific one of the N MPM lists, index information (an MPMindex) indicating the position or number of the intra prediction mode inthe specific MPM list may be entropy-encoded. In addition, the sameintra prediction mode as the intra prediction mode of the current blockamong the intra prediction modes included in the specific MPM list maybe identified by entropy-decoding the index information. The indexinformation may be entropy-encoded to a fixed-length code or avariable-length code. In addition, the intra prediction mode of thecurrent block may be derived, using the index information.

In the absence of the same intra prediction mode as the intra predictionmode of the current block among the intra prediction modes included inthe N MPM lists, a remaining intra prediction mode of the current blockmay be entropy-encoded in the encoder. The remaining intra predictionmode may be used to identify the intra prediction mode of the currentblock that is not included in at least one of the MPM lists. Or, theremaining intra prediction mode may be used to identify the intraprediction mode of the current block that is included in none of the MPMlists.

An MPM list may include a predetermined number N of candidate modes.Each of the N candidate modes may be represented by using MPM_mode_idxK(K is an integer belonging to 1 to N). An order for padding a candidatemode corresponding from idx1 to idxN to the MPM list may be adaptivelydetermined on the basis of a number of frequencies of an intra mode ofneighbor blocks. Herein, the intra mode may mean an intra-predictionmode or an intra-prediction angle. Alternatively, a type or arrangementorder or both of the candidate modes may be determined by considering atleast one of a position of a neighbor block, an intra-prediction mode ofa neighbor block, whether or not an intra-prediction mode is angularmode, an angle of an intra-prediction mode, and a number of frequenciesof intra-prediction mode.

FIG. 6 is a view showing a neighbor block of a current block.

A neighbor block of a current block to be encoded/decoded may include atleast one of a left side block, a lower left side block, an upper sideblock, an upper right side block, and an upper left side block of thecurrent block.

For example, in FIG. 6, when the current block is P, the left side blockmay be at least one of blocks L, M, and N. The lower left side block maybe a block of 0. The upper side block may be at least one of blocks G,H, and I. The upper right side block may be a block J. The upper leftside block may be at least one of blocks D and E.

When a number of candidate blocks of a neighbor block at a specificposition is a positive integer N, an intra-prediction mode of acorresponding neighbor block may be determined by a combination of Ncandidate blocks. Herein, the combination may mean at least one ofstatistical values including a maximum value (max), a minimum value(min), a median value (median), a weight sum (floor calculation ofweight sum, cell calculation weight sum, or round calculation of weightsum) of intra-prediction modes of N candidate blocks.

Alternatively, when a number of candidate blocks is N, anintra-prediction mode of a neighbor block may be determined on the basisof all or a part of intra-prediction modes of N candidate blocks. Thepart of intra-prediction modes may be a candidate block(s) at a positionpredetermined in an image encoding/decoding apparatus.

For example, in FIG. 6, when the current block is P, an intra-predictionmode of a left side block may be determined as an intra-prediction modeof a candidate block L, an intra-prediction mode of a candidate block M,or an intra-prediction mode of a candidate block N. Alternatively, anintra-prediction mode of a left side block may be determined bycombining intra-prediction modes of at least two candidate blocksselected from three candidate blocks L, M, and N.

By using intra-prediction modes of neighbor blocks of a current block,an MPM list may be initialized according to a predetermined order.

FIG. 7 is a view showing an embodiment of initializing an MPM list of acurrent block. The initialization may mean adding an intra-predictionmode to the MPM list.

FIG. 7(a) is a view showing a case where a current block is a squareblock.

FIGS. 7(b) and 7(c) are view showing a case where a current block isnon-square block. In the embodiment shown in FIG. 7, an MPM list of acurrent block may be configured by referencing an intra-prediction modeof seven neighbor blocks (left side left side 2, upper side 1, upperside 2, lower left side, upper right side, and upper left side blocks).

In the embodiment shown in FIG. 7, a predetermined order of configuringan MPM list may vary according to a size or form or both of the currentblock.

A predetermined order of initializing an MPM list may be an order offollowing blocks: left side 1→upper side upper right side→lower leftside→upper left side. Alternatively, the predetermined order may be anorder of following blocks: left side →upper side 1→lower left side→upperright side→upper left side. Alternatively, the predetermined order maybe an order of following blocks: left side 1→upper side→upper leftside→upper right side→lower left side. Alternatively, the predeterminedorder may be an order of following blocks: left side 1→upper side1→upper left side→lower left side→upper right. Alternatively, thepredetermined order may be an order of following blocks: left side 1upper side 1→left side 2→upper side2→upper right side→lower leftside→upper left side. Alternatively, the predetermined order may be anorder of following blocks: left side 1→upper side 1→left side 2→upperside 2→lower left side upper right side→upper left side. Alternatively,the predetermined order may be an order of following blocks: left side1→upper side 1→left side 2→upper side 2→upper left side→upper rightside→lower left side, Alternatively, the predetermined order may be anorder of following blocks: left side 1→upper side 1→left side 2→upperside 2→upper left side→lower left side→upper right side. Alternatively,the predetermined order may be an order of following blocks: left side2→upper side 2→left side 1→upper side 1→upper right side→lower leftside→upper left side. Alternatively, the predetermined order may be anorder of following blocks: left side 2→upper side 2→left side 1→upperside 1→lower left side→upper right side→upper left side. Alternatively,the predetermined order may be an order of following blocks: left side2→upper side 2→left side 1→upper side 1→upper left side→upper rightside→lower left side. Alternatively, the predetermined order may be anorder of following blocks: left side 2→upper side 2→left side 1→upperside 1→upper left side→lower left side→upper right side.

According to another embodiment of the present invention, when a currentblock is non-square block with a horizontal length longer than avertical length, an intra-prediction mode of a left side neighbor blockof the current block may be preferentially added to an MPM list. Forexample, an intra-prediction mode of neighbor blocks may be added to theMPM list in an order of following blocks: left side 1→left side 2→upperside 1→upper side 2→upper left side→lower left side→upper right side.

When a current block is non-square block with vertical length longerthan a horizontal length, an intra-prediction mode of an upper sideneighbor block of the current block may be preferentially added to anMPM list. For example, an intra-prediction mode of neighbor blocks maybe added to the MPM list in an order of following blocks: upper side 1→upper side 2→left side 1→left side 2→upper left side→lower leftside→upper right side.

In order to initialize an MPM list, another order other than the aboveexample orders may be applied.

Initializing an MPM list (or re-arrangement) may be performed in apredetermined block unit. Herein, the block unit may mean a codingblock, a prediction block, or a transform block. Alternatively,initializing an MPM list (or re-arrangement) may be performed in apredetermined regional unit configured with a plurality of block units.The predetermined region may be a region defined for updating a numberof frequencies of intra-prediction mode. A size or form or both of theregion may be predetermined in an image encoding/decoding apparatus, ormay be variably determined on the basis of information encoded forspecifying the region.

Alternatively, initializing an MPM list (or re-arrangement) may beselectively performed on the basis of a predetermined flag. The flag maybe signaled from an image encoding apparatus, or may be derived byconsidering a number of frequencies of an intra-prediction mode of aneighbor block.

Alternatively, initializing an MPM list (or re-arrangement) may beselectively performed on the basis of a size or form or both of acurrent block. For example, initializing an MPM list (or re-arrangement)may be performed when the current block has a specific form. Herein, thespecific form may mean a square or non-square form, a horizontally longnon-square or vertically long non-square form, or a symmetrical orasymmetrical form. For example, initializing an MPM list (orre-arrangement) may be performed when a size of the current block isequal to a predetermined threshold size, or may be performed when thesize of the current block is smaller or greater than a predeterminedthreshold size. The threshold size may be a value predetermined in animage encoding/decoding apparatus, or may be determined on the basis ofsignaled information of the threshold size. Alternatively, initializingan MPM list (or re-arrangement) may be performed regardless of a size orform or both of the current block.

When initializing an MPM list of a current block by using anintra-prediction mode of a neighbor block, a number of occurrencefrequencies of each candidate mode of the MPM list may be initialized.For initializing the number of occurrence frequencies, at least one ofmethods described below may be used.

For example, a number of frequencies of all candidate modes may beinitialized by using the same predetermined value. The predeterminedvalue may be a positive integer including zero.

Alternatively, a number of frequencies of a candidate mode may bedetermined on the basis of a block size of a neighbor block. Forexample, when the neighbor block has a size and form of WxH, a number offrequencies of each candidate mode of an MPM list may be initialized asW*H, W, or H.

Alternatively, a number of frequencies of each candidate mode may bedifferently initialized according to a position of a neighbor block of acurrent block. For example, a number of frequencies of left sideneighbor blocks of the current block may be initialized as an H (height)value of a corresponding neighbor block. Similarly, a number offrequencies of upper side neighbor blocks of the current block may beinitialized as a W (width) value of a corresponding neighbor block.

Herein, a form of the current block (whether the current block is squareor non-square, and in case the current block is non-square, whether thecurrent block has a longer horizontal length or vertical length) may beconsidered.

When a current block is a non-square block having a horizontal lengthlonger than a vertical length, an MPM list may be initialized as ahorizontal mode. In other words, the horizontal mode may be morepreferentially added to the MPM list than other modes. Herein, thehorizontal mode may mean the exact horizontal mode, or may mean all or apart of modes including a horizontal mode and modes adjacent to thehorizontal mode (horizontal mode±Q). Herein, Q may be a positiveinteger.

When a current block is non-square block having a vertical length longerthan a horizontal length, an MPM list may be initialized as a verticalmode. In other words, the vertical mode may be more preferentially addedto the MPM list than other modes. i5 Herein, the vertical mode may meanthe exact vertical mode, or may mean all or a part of modes including avertical mode and modes adjacent to the vertical mode (vertical mode±Q).Herein, Q may be a positive integer.

Alternatively, an MPM list may be initialized by using at least one of aPLANAR mode, a DC mode, a horizontal mode, a vertical mode, a 45 degreeangle mode, a 135 degree angle mode, and a 225 angular mode. In otherwords, at least one of a PLANAR mode, a DC mode, a horizontal mode, avertical mode, a 45 degree angle mode, a 135 degree angle mode, and a225 degree angle mode may be more preferentially added to the MPM listthan other modes.

A mode candidate set including at least one of a PLANAR mode, a DC mode,a horizontal mode, a vertical mode, a 45 degree angle mode, a 135 degreeangle mode, and a 225 degree angle mode may be configured. In addition,an MPM list may be initialized by using the mode candidate set accordingto at least one of coding parameters such as size, form, etc. of acurrent block.

After initializing an MPM list, a number of occurrence frequencies ofeach intra mode of neighbor blocks may be checked. For example, acandidate mode stored in the MPM list may be checked in an order fromidx1 to idxN, and when an intra mode overlaps, a number of frequenciesof the corresponding intra mode may be increased by K. K may be apredetermined positive integer.

After initializing a number of occurrence frequencies of candidate modesstored in an MPM list of a current block, a number of frequencies of acorresponding mode may be updated when identical candidate modes arepresent in the MPM list.

For example, whether or not an identical candidate mode is presentwithin an MPM list may be checked in an order from idxl to idxN. Herein,when a candidate mode that is currently checked is a mode correspondingto idxK (herein, K is a positive integer equal to or smaller than N), anumber of frequencies of idxP may be updated by comparing candidatemodes from idxl to idxL (herein, L is a positive integer smaller thanK), and adding a number of frequencies of idxK to a number offrequencies of idxP when the candidate mode of idxP (herein, P is apositive integer equal to or smaller than L) is identical to thecandidate mode of idxK. Herein, the candidate mode corresponding to idxKmay be removed from the MPM list.

By performing the above process up to a candidate mode corresponding toidxN, an MPM list in which candidate modes do not overlap may begenerated. Herein, a number of frequencies of each candidate mode of thegenerated MPM list may be identical or may vary.

After updating a number of occurrence frequencies of candidate modeswithin a MPM list of a current block and updating the MPM list so as tocandidate modes thereof do not overlap, candidate modes within the MPMlist may be sorted in descending or ascending order on the basis of anumber of occurrence frequencies.

As another example of re-arranging candidate modes of an MPM list on thebasis of a number of occurrence frequencies, when padding each candidatemode to the MPM list from idx1 to idxN according to a predeterminedorder that scans neighbor blocks of a current block, whether or not acandidate mode that is currently to be added overlaps with candidatemodes stored in the MPM list may be checked, and an order of pre-storedcandidate modes may be changed. For example, when adding a candidatemode corresponding to idxK (K is a positive integer equal to or smallerthan N) to the MPM list, when the candidate mode overlaps with one ofcandidate modes from idx1 to idx(K-1) which are pre-stored in the MPMlist, the pre-stored overlapping candidate mode may be replaced with acandidate mode corresponding to idx(K-J), and the idxK mode may not beadded to the MPM list. Herein, J a positive integer smaller than K.

Updating of a number of occurrence frequencies of an intra-predictionmode of a neighbor block and re-initializing may be performed in atleast one of a block unit, a OTU unit, a slice unit, a picture unit, anda group of picture (GOP) unit.

For example, a number of occurrence frequencies of an intra-predictionmode of a neighbor block may be accumulated in a unit of a currentblock, and a number of frequencies of all intra-prediction modes beforethe following block may be initialized as zero.

Alternatively, a number of occurrence frequencies of an intra-predictionmode of a neighbor block may be accumulated in a unit of N blocks, and anumber of frequencies of all intra-prediction mode may be initialized aszero before encoding/decoding the following N blocks afterencoding/decoding the N blocks.

Alternatively, a number of occurrence frequencies of an intra-predictionmode of a neighbor block may be accumulated in a unit of CTU, slice orpicture, and a number of frequencies of all intra-prediction modes maybe initialized as zero before encoding/decoding the following CTU, sliceor picture after encoding/decoding all blocks within the CTU, slice orpicture.

A number of occurrence frequencies of candidate modes stored in an MPMlist of a current block may be checked, and an order of the candidatemodes stored in the MPM list may be re-arranged in descending orascending order according to the number of occurrence frequencies.Herein, when a plurality of intra-prediction modes having the samenumber of occurrence frequencies is present, the existing order may bemaintained or changed.

Sorting in descending order may be performed on the basis of a number ofoccurrence frequencies, and when a current block has five neighborblocks which are left side, lower left side, upper side, upper rightside, and upper left side blocks, candidate modes of an MPM list may bere-arranged by using at last one of methods described below.

For example, when all of five neighbor blocks have an intra-predictionmode different from each other, and a number of frequencies is one, theexisting order may be maintained, and re-arrangement of candidate modesof an MPM list may not be performed.

For example, when one intra-prediction mode having a number ofoccurrence frequencies of two, three intra-prediction modes having anumber of occurrence frequencies of one are present, the oneintra-prediction mode having a number of occurrence frequencies of twomay be assigned to idx1 of an MPM list, and the three intra-predictionmodes having a number of occurrence frequencies of one may berespectively assigned to idx2, idx3, idx4 while maintaining the existingorder.

For example, when two intra-prediction modes having a number ofoccurrence frequencies of two, and one intra-prediction mode having anumber of occurrence frequencies of one are present, the twointra-prediction modes having a number of occurrence frequencies of twomay be respectively assigned to idx1, idx2 of an MPM list whilemaintaining the existing order, and the one intra-prediction mode havinga number of occurrence frequencies of one may be assigned to idx3.

For example, when one intra-prediction mode having a number ofoccurrence frequencies of three, and two intra-prediction mode having anumber of occurrence frequencies of one are present, the oneintra-prediction mode having a number of occurrence frequencies of threemay be assigned to idx1 of an MPM list, and the two intra-predictionmodes having a number of occurrence frequencies of two may berespectively assigned to idx2, idx3 while maintaining the existingorder.

For example, when one intra-prediction mode having a number ofoccurrence frequencies of three, and one intra-prediction mode having anumber of occurrence frequencies of two are present, the oneintra-prediction mode having a number of occurrence frequencies of threemay be assigned to idx1 of an MPM list, and the one intra-predictionmode having a number of occurrence frequencies of two may be assigned toidx2.

For example, when one intra-prediction mode having a number ofoccurrence frequencies of four, and one intra-prediction mode having anumber of occurrence frequencies of one are present, the oneintra-prediction mode having a number of occurrence frequencies of fourmay be assigned to idx1 of an MPM list, and the one intra-predictionmode having a number of occurrence frequencies of one may be assigned toidx2.

As another example of re-arranging candidate modes of an MPM list on thebasis of a number of occurrence frequencies, when padding each candidatemode to the MPM list from idx1 to idxN according to a predeterminedorder that scans neighbor blocks of a current block, whether or not acandidate mode that is currently to be added overlaps with candidatemodes stored in the MPM list may be checked, and an order of pre-storedcandidate modes may be changed. For example, when adding a candidatemode corresponding to idxK (K is a positive integer equal to or smallerthan N) to the MPM list, when the candidate mode overlaps with one ofcandidate modes from idx1 to idx(K-1) which are pre-stored in the MPMlist, the pre-stored overlapping candidate mode may be replaced w with acandidate mode corresponding to idx(K-J), and the idxK mode may not beadded to the MPM list. Herein, a positive integer smaller than K.

For an MPM list that is re-arranged on the basis of a number ofoccurrence frequencies, a position at which a PLANAR mode and a DC modewhich are non-angular modes may be included may be determined on thebasis of a specific threshold value ‘Th’. Herein, ‘Th’ may be apredetermined positive integer. ‘Th’ may be derived on the basis of anumber of frequencies of a candidate mode belonging to the MPM list. Forexample, ‘Th’ may be determined on the basis of at least one ofstatistical values including a maximum value, a minimum value, anaverage value of a number of frequencies of a candidate mode.

Among candidate modes of the re-arranged MPM list, at a position next tocandidate modes having a number of occurrence frequencies of being equalto or greater than P, a PLANAR mode and a DC mode may be added as acandidate mode. The P may be an integer of 2 or 3 or greater.

After the above process, when all of N candidate modes of an MPM listare not added, the candidate mode may be added until the N candidatemodes are padded in the list by using at least one of methods describedbelow.

For example, when an angular mode is present among candidate modespresent in an MPM list, an intra-prediction mode that is ‘correspondingangle mode ±1’ may be added from idx1 to idxN according to an order as acandidate mode.

For example, among angular modes, at least one of a horizontal mode, avertical mode, a 45 degree angle mode, a 135 degree angle mode, and a225 degree angle mode may be added as a candidate mode.

When configuring an MPM list, an order from idx1 to idxN of includingcandidate modes to the MPM list may be adaptively determined accordingto intra-prediction modes of at least one of left side, lower left side,upper side, upper right side, and upper left side neighbor blocks of acurrent block.

A number K of referenced neighbor blocks may be determined according toat least one a size or form or both of a current block, an imageresolution, and a QP value. Herein, K may be a positive integer. Herein,when a horizontal length of the image resolution or a horizontal lengthof the current block is VV, and a vertical length of the imageresolution or a vertical length of the current block is H, the size ofthe image and the current block may be represented as one of valuesbeing greater or smaller than W*H, W, H, W+H, W, and H. Herein, W, and Hmay be a positive integer. Alternatively, the number K may be a fixedvalue predefined in an image encoding/decoding apparatus.

For example, when an image or current block or both have a specific sizeor greater, K neighbor blocks or more may be referenced. For example,when the image or current block or both have a size equal to or smallerthan a specific size, K neighbor blocks or less may be referenced. Forexample, when the image or current block or both have a specific size orgreater, K neighbor blocks or less may be referenced. For example, whenthe image or current block or both have a specific size or smaller, Kneighbor blocks or more may be referenced. For example, when the imageor current block or both have a QP value equal to or greater than aspecific value, K neighbor blocks or more may be referenced. Forexample, when the image or current block or both have a QP value equalto or smaller than a specific value, K neighbor blocks or less may bereferenced. For example, when the image or current block or both have aQP value equal to or greater than a specific value, K neighbor blocks orless may be referenced. For example, the image or current block or bothhave a QP value equal to or smaller than a specific value, K neighborblocks or more may be referenced.

When a number of neighbor blocks referenced by a current block is K,positions of the referenced neighbor blocks may be determined by usingone of the methods W described below according to the predeterminedorder.

For example, a number corresponding to veil(K/2) or floor(K/2) of leftside neighbor blocks and a number corresponding to a floor(K/2) or aceil(K/2) of upper side blocks may be referenced. For example, all ofleft side neighbor blocks may be preferentially referenced, and thenwhen a number of referenced neighbor block is smaller than K, upper sideneighbor blocks may be referenced until the K blocks are referenced.

Alternatively, on the contrary, upper side neighbor blocks may bepreferentially referenced, and then when a number of referenced neighborblocks is smaller than K, left side neighbor blocks may be referenceduntil the K blocks are referenced.

When a number (K) and a position of neighbor blocks for configuring anMPM list are determined, the MPM list of a current block may be variablyconfigured on the basis of an intra-prediction mode of neighbor blocks.Herein, an MPM mode may have N candidate modes, N may be a positiveinteger, and K may be defined as a positive integer equal to or smallerthan N.

For example, in order to configure an MPM list of a current block, foran intra-prediction mode of K referenced neighbor blocks, at least oneof conditions described below may be used.

The conditions are as follows: when all of K neighbor blocks have aPLANAR mode, when all of K neighbor blocks have a DC mode; when Kneighbor blocks have a combination of a PLANAR mode and a DC mode; whenall of K neighbor blocks have an angular mode; when, among K neighborblocks, L neighbor blocks are angular modes and K-L neighbor blocks arePLANAR modes or DC modes (herein, L is a positive integer smaller thanK); when all of K neighbor blocks are a horizontal angular mode; whenall of K neighbor blocks are a vertical angular mode; and when, among Kneighbor blocks, L neighbor blocks are a horizontal angular mode and K-Lneighbor blocks are a vertical angular mode (herein, L is a positiveinteger smaller than K).

For example, when all of K neighbor blocks referenced for configuring anMPM list of a current block have an angular mode, or when K neighborblocks have more angular modes than non-angular modes, angular modes maybe preferentially added to from idx1 to idxN of the MPM list as acandidate mode.

Alternatively, when all or a part of K referenced neighbor blocks havean angular mode, a corresponding angular mode may be preferentiallyadded to an MPM list. Alternatively, when all or a part of K referencedneighbor blocks have non-angular mode, a corresponding non-angular modemay be preferentially added to the MPM list, and may be added at apredefined fixed position.

In one embodiment, when the above condition is satisfied, an angularmode may be preferentially added to an MPM list, The added angular modemay be an angular mode of neighbor blocks referenced by the currentblock. Herein, among angular modes of neighbor blocks, when at least twomodes not overlapping are present, adding may be sequentially performedfrom idx1 according to a predetermined neighbor block reference order asa candidate mode. The predetermined reference order may be, for example,an order of left side block→upper side block→upper left side block→upperright side block→lower left side block. [ 00262 ] In the aboveembodiment, angular modes of neighbor blocks may be preferentially addedto the MPM list, and then, at least one of modes obtained by adding ±1,±2, ±3, ±4, ±5, ±6, ±7, ±8 . . . to the angular mode may be added to theMPM list, and at least one of a horizontal mode, a vertical mode, a 45degree angle mode, a 135 degree angle mode, and a 225 degree angle modemay be added to the MPM list, Intra-prediction mode obtained by adding aspecific offset to the angular mode of the neighbor block such as ±1,±2, ±3, ±4, ±5, ±6, ±7, ±8 . . . may be added to the MPM list in anorder as in which an absolute value of the offset increases. Afteradding the intra-prediction mode obtained by adding the specific offsetto the angular mode of the neighbor block such as ±1, ±2, ±3, ±4, ±5,±6, ±7, ±8 . . . at least one of a horizontal mode, a vertical mode, a45 degree angle mode, a 135 degree angle mode, and a 225 degree anglemode may be added to the MPM list.

In the above embodiment, when a PLANAR mode and a DC mode which arenon-angular mode are added to the MPM list, indexes (position) where thePLANAR mode and the DC mode are added may be fixed or vary. For example,the PLANAR mode may be fixedly added to idxA, and the DC mode may befixedly added to idx9 as a candidate mode. Herein, A and B may be apositive integer—equal to or smaller than N. Alternatively, when Kneighbor blocks have an angular mode, a PLANAR mode may be added toidxC, and a DC mode may be added to idxD as a candidate mode, Herein, Cand D may be a positive integer greater than K equal to or smaller thanN. In other words, at least one of the horizontal mode, the verticalmode, the 45 degree angle mode, the 135 degree angle mode, and the 225degree angle mode may be added to the MPM list, and then at least one ofthe PLANAR mode and the DC mode may be added to the MPM list.

For example, when all of K referenced neighbor blocks are a PLANAR mode,the PLANAR mode may be added to idx1 of an MPM list as a candidate mode.

For example, when all of K referenced neighbor blocks are a DC mode, theDC mode may be added to idx1 of an MPM list as a candidate mode.

For example, when all of K referenced neighbor blocks are a PLANAR or aDC mode, the PLANAR mode may be added to idx1 or idx2 of an MPM list,and the DC mode may be added to idx2 or idx1 of the MPM list as acandidate mode.

The intra prediction mode of the current block for which the N MPM listsare used may be entropy-encoded/decoded in the manners of the followingembodiments.

In the presence of the same intra prediction mode as the intraprediction mode of the current block among the intra prediction modesincluded in MPM_LIST_1, MPM_LIST_2, . . . , and MPM_LIST_N, the encodermay entropy-encode the indicators MPM_FLAG_1, and MPM_FLAG_N indicatingwhich list among MPM_LIST_1, MPM_LIST_2, . . . , and MPM_LIST_N includesthe same intra prediction mode as the intra prediction mode of thecurrent block. If the intra prediction mode of the current block existsin MPM_LIST_1, MPM_FLAG_1 may be the first value, and MPM_FLAG_2, . . ., and MPM_FLAG_N except for MPM_FLAG_1 may be the second value. In thiscase, the index information about MPM_LIST_1, MPM_IDX_1 may further beentropy-encoded.

Or, if the intra prediction mode of the current block exists inMPM_LIST_2, MPM_FLAG_2 may be the first value and MPM_FLAG_1, andMPM_FLAG_N except for MPM_FLAG_2 may be the second value, In this case,the index information about MPM_LIST_2, MPM_IDX_2 may further beentropy-encoded.

Or, if the intra prediction mode of the current block exists inMPM_LIST_N, MPM_FLAG_N may be the first value and MPM_FLAG_1, andMPM_FLAG_(N-1) except for MPM_FLAG_N may be the second value. In thiscase, index information about MPM_LIST_N, MPM_IDX_N may further beentropy-encoded.

In the absence of the same intra prediction mode as the intra predictionmode of the current block among the intra prediction modes included inMPM_LIST_1, MPM_LIST_2, . . . , and MPM_LIST_N, the encoder mayentropy-encode MPM_FLAG _1, MPM_LIST_2, . . . , and MPM_FLAG_N,indicating which list among MPM_LIST_1, and MPM_LIST_N includes the sameintra prediction mode as the Intra prediction mode of the current blockto the second value. If MPM_FLAG_1, and MPM_FLAG_N are the second value,the remaining intra prediction mode, REM_MOSE may further beentropy-encoded.

The decoder may entropy-decode the indicators MPM_FLAG_1, MPM_FLAG_2,and MPM_FLAG_N indicating which list among MPM_LIST_1, . . . , andMPM_LIST_N includes the same intra prediction mode as the intraprediction mode of the current block. if MPM_FLAG_1 is the first valueand MPM_LIST_2, . . . , and MPM_LIST_N except for MPM_FLAG_1 are thesecond value, the intra prediction mode of the current block may existin MPM_LIST_1. In this case, the intra prediction mode of the currentblock may be derived by further entropy-decoding the index informationabout MPM_LIST_1, MPM_IDX_1.

Or, if MPM FLAC3_2 is the first value and MPM_LIST_1, . . . , andMPM_LIST_N except for MPM_LIST_2 are the second value, the intraprediction mode of the current block may exist in MPM_LIST_2. In thiscase, the intra prediction mode of the current block may be derived byfurther entropy-decoding the index information about MPM_LIST_2,MPM_IDX_2.

Or, if MPM_FLAG_N is the first value and MPM_LISL1, and MPM_LIST_(N-1)except for MPM_LIST_N are the second value, the intra prediction mode ofthe current block may exist in MPM_LIST_N. In this case, the intraprediction mode of the current block may be derived by furtherentropy-decoding the index information about MPM_LIST_N, MPM_IDX_N.

Or, if MPM_FLAG_1, MPM_FLAG_2, . . . , and MPM_FLAG_N are the secondvalue, the intra prediction mode of the current block may be derived byfurther entropy-decoding the remaining intra prediction mode, REM_MODE.Herein, the case where all of MPM_FLAG, . . . , MPM_FLAG_2, . . . , andMPM_FLAG_N are the first value may not W occur.

Now, a description will be given of another embodiment for the casewhere N MPM lists are used for a current block.

TABLE 1 coding_unit[ x0, y0, log2CbSize ]{ Descriptor  . . . MPM_FLAG_1[ x0 + i ][ y0 + j ] ae(v)  if( MPM_FLAG_1[ x0 + i ][ y0 + j] )   MPM_IDX_1[ x0 + i ][ y0 + j ] ae(v)  else{   MPM_FLAG_2[ x0 + i ][y0 + j ] ae(v)   if( MPM_FLAG_2[ x0 + i ][ y0 + j ] )    MPM_IDX_2[ x0 +i ][ y0 + j ] ae(v)   else {    . . .    MPM_FLAG_N[ x0 + i ][ y0 + j ]ae(v)    if( MPM_FLAG_N[ x0 + i ][ y0 + j ] )     MPM_IDX_N[ x0 + i ][y0 + j ] ae(v)    else     REM_MODE[ x0 + i ][ y0 + j ] ae(v)  }  . . .}

As in the example of [Table 1], the encoder may entropy-encode the intraprediction mode of the current block by sequentially checking whetherthe same intra prediction mode as the intra prediction mode of thecurrent block exists among the intra prediction modes included in eachof MPM_LIST_1, MPM_LIST_2, . . . , MPM_LIST_N according to at least oneof the orders of making the plurality of MPM lists.

A flag specifying an MPM list such as MPM_FLAG_N or an index indicatingone of a plurality of MPM lists may be encoded/decoded. Informationindicating whether an MPM-based intra prediction derivation method isused for a current block (or a current slice, a current picture, acurrent sequence, etc.) may be encoded/decoded. If the informationindicates that the MPM-based intra prediction derivation method is used,the index may be encoded/decoded. At least one of the number or types ofa plurality of MPM lists may be fixedly predefined in theencoder/decoder, or may be variably determined based on parametersrelated to the size, depth, shape, position, and so on of the currentblock/a neighbor block. For example, the number of MPM lists, predefinedin the encoder/decoder may be 1, 2, 3, or larger. The maximum number ofintra prediction modes included in each MPM list may be forced to beequal. The maximum number may be fixedly preset in the encoder/decoder,or may be signaled in a predetermined unit (e.g., a sequence, a picture,a slice, a block, etc.). If the number of intra prediction modesincluded in a specific MPM list is smaller than the maximum number, apredetermined mode may be added to the specific MPM list. The added modemay be a preset default mode, or an intra prediction mode included inanother MPM list. Notably, a mode different from the intra predictionmodes included in the specific MPM list may be added. A redundancy checkbetween MPM lists may be omitted. One of MPM lists may share at leastone same intra prediction mode with another MPM list.

Now, another embodiment for he case where N MPM lists are used for acurrent block will be described.

The encoder may make a plurality of MPM lists ranging from MPM_LIST_1 toMPM_LIST_N in at least one of the orders of making a plurality of MPMlists. The total number of candidate intra prediction modes in the N MPMlists may be K. N and K may be positive integers.

For example, MPM_LIST_combined may be made up of K or fewer candidateintra prediction modes out of the candidate intra prediction modes ofthe N MPM lists.

For example, if the same intra prediction mode as the intra predictionmode of the current block exists in MPM_LIST_combined, an indicatorMPM_FLAG_combined indicating whether the same intra prediction mode asthe intra prediction mode of the current block exists inMPM_LIST_combined may be entropy-encoded to a first value. Herein, indexinformation about MPM_LIST_combined, MPM _IDX_combined may additionallybe entropy-encoded.

In the absence of the same intra prediction mode as the intra predictionmode of the current block in MPM_LIST_combined, MPM_FLAG_combined may beentropy-encoded to a second value. If MPM_FLAG_combined is the secondvalue, the remaining intra prediction mode, REM_MODE may additionally beentropy-encoded.

The decoder may entropy-decode the indicator MPM_FLAG_combinedindicating whether the same intra prediction mode as the intraprediction mode of the current block exists in MPM_LIST_combined. IfMPM_FLAG_combined is the first value, the intra prediction mode of thecurrent block may be derived by further entropy-decoding the indexinformation MPM_IDX_combined. If MPM_FLAG_combined is the second value,the intra prediction mode of the current block may be derived byadditionally entropy-decoding the remaining intra prediction mode,REM_MODE.

According to the present invention, the intra prediction mode of thecurrent block may be derived by encoding/decoding. Herein, the intraprediction mode of the current block may be entropy-encoded/decodedwithout using the intra prediction mode of a neighbor block.

The intra-prediction mode of the current block may be induced using anintra-prediction mode of another color component. For example, when thecurrent block is a chroma block, an intra-prediction mode of at leastone relevant-luma block corresponding to the chroma target block may beused to induce an intra-prediction mode for the chroma block. Here, therelevant-luma block may be determined based on at least one of theposition, size, shape, or coding parameter of the chroma block.Alternatively, the relevant-luma block may be determined based on atleast one of the size, shape, or coding parameter of the luma block.

The relevant-luma block may be determined using a luma block including asample corresponding to the central position of the chroma block, orusing at least two luma blocks respectively including samplescorresponding to at least two positions of chroma blocks. The at leasttwo positions may include an upper left sample position and a centersample position.

When there are several relevant-lura blocks, a statistic value ofintra-prediction modes of at least two relevant-luma blocks may beinduced as the intra-prediction mode of the chroma block. Alternatively,an intra-prediction mode of a relatively large relevant-luma block maybe induced as the intra-prediction mode of the chroma block.Alternatively, when the size of the luma block corresponding to apredetermined position of the chroma block is equal to or greater thanthe size of the chroma block, the intra-prediction mode of the chromablock may be induced using the intra-prediction mode of therelevant-lura block.

For example, when the current block is partitioned into sub-blocks, theintra-prediction mode of each of the partitioned sub-blocks may beinduced using at least one method of inducing the intra-prediction modeof the current block.

When deriving an intra-prediction mode, a number of intra-predictionmodes used when encoding/decoding may vary according to a form of acurrent block having a WxH size. Herein. W, and H may be a positiveinteger. When a number of angular modes used for a square block (when Wand H have the same value) is N (herein, W N is a positive integer), anumber of angular modes for a non-square block (when W and H havedifferent values) may be K smaller than N. Herein, both N and K may be apositive integer.

FIG. 8 is a view showing a number of intra-prediction modes that areusable according to a block form.

FIG. 9 is a view showing an angle of an angular intra-prediction mode.

FIG. 8 is a view showing various examples of non-square block includedin a CTU having a 128×128 size. In FIG. 8, a small block may mean a 4×4block. Numbers within the block may mean a Z-scanning order.

In FIGS. 8(a) to 8(d), shaded areas may mean a current block.Accordingly, the current block shown in FIGS. 8(a) and 8(b) shows anexample of non-square block where W is greater than H. In addition, thecurrent block shown in FIGS. 8(c) and 8(d) shows an example ofnon-square block where W is smaller than H.

When a number of angular modes for a square block is N, a number ofintra-prediction modes (angular mode) for non-square block may bedetermined by using one of examples described below.

As show in FIGS. 8(a) and 8(b), when the current block is a horizontallylong non-square block, modes between two arrows may be used, Referringto FIG. 9, for a horizontally long non-square block, intra-predictionmay be performed by using intra-prediction modes between a 135 degreeangle and a 225 angle. In other words, intra-prediction may be performedby using a horizontal mode and at least one of modes adjacent to thehorizontal mode. In addition, a number of usable intra-prediction modesis limited, and thus encoding/decoding of an intra-prediction mode maybe performed on the basis of the limited number of usableintra-prediction modes.

FIGS. 8(c) and 8(d) show cases where the current block is a verticallylong non-square block. Herein, referring to FIG. 9, intra-predictionmodes between a 45 degree angle and a 135 degree angle may be used. Inother words, intra-prediction may be performed by using a vertical modeand at least one of modes adjacent to the vertical mode.

When two non-angular modes (mode 0 and mode 1) and 65 angular modes(mode 2 to mode 66) are present, in FIGS. 8(a) and 8(b), from mode 2corresponding to a 225 angle to mode 34 corresponding to a 135 degreeangle may be used. Alternatively, on the basis of mode 18 correspondingto a 180 degree angle, intra-prediction of a current block may beperformed and an intra-prediction mode may be encoded/decoded by usingfrom mode (18−P) to mode (18+P). Herein, P may be a positive integer,when angular modes are 65 in total, P may be a positive integer smallerthan 16.

In addition, in FIGS. 8(c) and 8(d), 33 modes from mode34 correspondingto a 135 angle to mode66 corresponding to a 45 degree angle may be used.Alternatively, on the basis of mode 50 corresponding to a 90 degreeangle, intra-prediction for a current block may be performed and anintra-prediction mode may be encoded/decoded by using modes from mode(50−P) to mode (50+P). Herein, P may be a positive integer, when angularmodes are 65 in total, P may be a positive integer smaller than 16.

For example, in FIGS. 8(a) to 8(d), intra-prediction for the currentblock may be performed and an intra-prediction mode may beencoded/decoded by using modes of M=N/P intra-prediction modes. Herein,P may be P=2^(K)(Herein, K is a positive integer).

When an intra-prediction mode identical to an intra-prediction mode of acurrent block is not preset in the derived MPM list, theintra-prediction mode of the current block may be encoded/decoded byusing the method described below.

In order to encodeidecode an intra-prediction mode of a current block,intra-prediction modes that are not included in an MPM list including Kcandidate modes may be sorted in at least one of descending andascending orders, When a total number of W intra-prediction modes usableby the current block is N, a number of the sorted intra-prediction modesmay be N-K. Herein, N may be a positive integer, and K may be a positiveinteger equal to or smaller than N.

A number L of bits required for encoding/decoding from the sortedintra-prediction mode to an intra-prediction mode of a current block mayvary according to a block form as below. Herein, L may be a positiveinteger.

A number of intra-prediction modes usable by a square block may be N,and a number of intra-prediction modes usable by non-square block may beM=N/2. Herein, when a number of bits required for encoding/decoding anintra-prediction mode of a square block is L, a number of bits requiredfor encoding/decoding an intra-prediction mode of non-square block maybe L-1.

As another example, when a number of intra-prediction mode usable bynon-square block is M=N/4, a number of bits required forencoding/decoding an intra-prediction mode of non-square block may beL-2.

Accordingly, when a number of intra-prediction mode usable by non-squareblock is M, M=N/(2^(K)), a number of bits required for encoding/decodingan intra-prediction mode of non-square block may be LK. Herein, M may bea positive integer, and 2^(K) may be a positive integer equal to orsmaller than N.

When a number of angular modes usable by non-square block is K, an MPMlist configured for encodingldecoding an intra-prediction mode may beconfigured on the basis of intra-prediction modes corresponding to Kangular modes.

For example, an intra-prediction mode not corresponding to K angularmodes may not be added to an MPM list.

Alternatively, intra-prediction modes corresponding to K angular modesmay be preferentially added to an MPM list, and then intra-predictionmodes not corresponding to K angular modes may be added to the MPM list.

Alternatively, intra-prediction modes corresponding to K angular modesmay be preferentially added to an MPM list, and then at least one of aPLANAR mode, a DC mode, a vertical mode, a horizontal mode, a 45 degreeangle mode, a 135 degree angle mode, and a 225 degree angle mode may beadded to the MPM list.

Alternatively, among intra-prediction modes corresponding to K angularmodes, a maximum number L of intra-prediction modes that may be added toan MPM list may be preset in an encoder/decoder, or may be signaled fromthe encoder to the decoder. Herein, L may be a positive integer smallerthan K.

When deriving an intra-prediction mode of a current block, theintra-prediction mode of the current block may be derived by usingindicators determining whether or not the intra-prediction mode of thecurrent block matches with at least one predetermined mode.

The predetermined intra-prediction mode indicated by the indicators maybe at least one of modes described below.

PLANAR Mode

DC Mode

At least one of a vertical mode, a horizontal mode, a 45 degree anglemode, a 135 angular mode, and a 225 degree angle mode

Mode represented by combining MPM candidate modes

Deriving the intra-prediction mode of the current block by using theindicators may be performed at the timing described below.

When an intra-prediction mode of a current block does not match with allcandidate modes of a plurality of MPM lists, encoding/decoding using theindicator may be performed.

Herein, when a total number of intra-prediction modes usable by acurrent block is N, and numbers of candidate modes from the first to theK-th MPM list are respectively from P₁ to P_(K), an intra-predictionmode of a current block may be one of Σ_(i=1) ^(K)(p_(i)) remainingmodes. Herein, N may be a positive integer, may be a positive integerequal to or smaller than N, and L may be a positive integer.

Herein, in order to derive an intra-prediction mode of a current blockfrom L remaining modes, indicators indicating whether or not theintra-prediction mode of the current block matches with at least onepredetermined mode may be encoded/decoded.

For example, when an indicator indicating whether or not matching withthe first predetermined mode has a first value, the intra-predictionmode of the current block may be derived as the first predeterminedmode.

For example, when all of indicators indicating whether or not matchingwith up to the T-th predetermined mode have a second value and anindicator indicating whether or not matching with the T+1-thpredetermined mode has a first value, the intra-prediction mode of thecurrent block may be derived as the T+1-th predetermined mode.

For example, when all of indicators indicating whether or not matchingwith a predetermined mode have a second value, the intra-prediction modeof the current block may be entropy encoded/decoded.

Herein, T may be a positive integer equal to or smaller than N, and thefirst value may be 1, and the second value may be zero.

Alternatively, before determining whether or not candidate modesincluded in a MPM list configuration and an MPM list match with anintra-prediction mode of a current block, encoding/decoding using theindicator may be performed.

Herein, when a total number of intra-prediction modes usable by acurrent block is N, indicators indicating whether or not anintra-prediction mode of a current block matches with at least onepredetermined mode may be encoded/decoded.

For example, when an indicator indicating whether or not matching withthe first predetermined mode has a first value, the intra-predictionmode of the current block may be derived as the first predeterminedmode.

For example, when all of indicators indicating whether or not matchingwith up to the T-th predetermined mode have a second value and anindicator indicating whether or not matching with the T+1-thpredetermined mode has a first value, the intra-prediction mode of thecurrent block may be derived as the T+1-th predetermined mode.

For example, when all of indicators indicating whether or not matchingwith a predetermined mode have a second value, the intra-prediction modeof the current block may be entropy encoded/decoded.

Herein, T may be a positive integer equal to or smaller than N, and thefirst value may be 1, and the second value may be zero.

A specific MPM list may be configured by using at east one ofintra-prediction modes indicated by the indicators.

The specific MPM list may include at least one of a PLANAR mode, a DCmode, a vertical mode, a horizontal mode, a 45 degree angle mode, a 135degree angle mode, and a 225 angular mode.

The specific MPM list may be configured before configuring a general MPMlist, Herein, the general MPM list may mean an MPM list of the aboveexamples. In other words, after configuring the specific MPM list byusing at least one of predetermined Intra-prediction modes indicated bythe indicators, the general MPM first may be configured by using atleast one of intra-prediction modes except for the intra-predictionmodes included in the specific MPM list.

The specific MPM list may be configured without using anintra-prediction mode of a neighbor block of a current block.Accordingly, process or calculation for deriving the intra-predictionmode of the neighbor block is not required, and thus reducing thecomplexity of the encoder/decoder.

Information (flag) of whether or not the specific MPM list is used maybe signaled from the encoder to the decoder.

In addition, a specific MPM index for indicating an MPM candidate withinthe specific MPM list may be additionally signaled from the encoder tothe decoder. In other words, at least one of the specific MPM index anda general MPM index may be signaled from the encoder to the decoder,When a specific MPM index that is entropy decoded in the decoderindicates an MPM candidate within the specific MPM list,intra-prediction for a current block may be performed by using anintra-prediction mode indicated by the corresponding MPM candidate.

Information of whether or not the specific MPM list is used and thespecific MPM index may be signaled from the encoder to the decoder in aform of one syntax element. For example, when the one syntax elementindicates a value of zero, it may mean that the specific MPM list is notused, and when the one syntax element indicates a value being equal toor greater than 1, it may indicate a specific MPM candidate within thespecific MPM list.

In addition, remaining intra-prediction modes may be configured by usingat least one of intra-prediction modes not included in a specific MPMlist and a general MPM list. Information of the configured remainingintra-prediction modes may be signaled from the encoder to the decoder.

Intra prediction information may be entropy-encoded/decoded. The intraprediction information may be signaled in at least one of a VPS(videoparameter set), an W SPS(sequence parameter set), a PPS(pictureparameter set), an APS(adaptation parameter set), a slice header, a tileheader, a unit of a CTU, a unit of a block, a unit of a CU, a unit of aPU and a unit of a TU. For example, intra prediction information maycomprise at least one among pieces of information below.

A flag indicating whether an MPM is matched: e.g.)prev_intra_luma_pred_flag

An index indicating a position in an MPM list: e.g.) mpm_idx

intra luma prediction mode information: e.g.) rem_intra_luma_pred_mode

intra chroma prediction mode information: e.g.) intra_chroma_pred_mode

An indicator (MPM flag) indicating, for each of N MPM lists, whether thesame intra prediction mode as the intra prediction mode of the currentblock is included among the intra prediction modes of the MPM list, whenthe intra prediction mode of the current block is derived orentropy-encoded/decoded using the N MPM lists: e.g.) MPM_FLAG_1,MPM_FLAG_2, MPM_FLAG_N

Index information indicating, when the same intra prediction mode as theintra prediction mode of the current block is included among the intraprediction modes of a specific one of the N MPM lists, the position orsequence of the intra prediction mode in the MPM list: e.g.) MPM_IDX 1,MPM_IDX_2, . . . , MPM_IDX_N

When an MPM (Most Probable Mode) flag is 1, an intra prediction mode ofa luma component may be derived from candidate modes including intraprediction modes of adjacent units having been already encoded/decodedby using an MPM index mpm_idx.

When the MPM (Most Probable Mode) flag is 0, the intra prediction modeof the luma component may be encoded/decoded by using intra predictionmode information on luma component rem_intra_luma_pred_mode,

An intra prediction mode of a chroma component may be encoded/decoded byusing intra prediction mode information on chroma componentintra_chroma_pred_mode and/or a corresponding intra prediction mode of achroma component block.

The intra prediction information may be entropy-encoded/decoded based onat least one of coding parameters.

At least one of the above-described pieces of intra predictioninformation may not be signaled based on at least one of the size andshape of the block.

For example. if the size of the current block is a predetermined size,at least one piece of intra prediction information about the currentblock may not be signaled, and at least one piece of information aboutintra prediction corresponding to the size of a previouslyencoded/decoded upper level block may be used. For example, if thecurrent block is shaped into a rectangle, at least one piece of intraprediction information about the current block may not be signaled, andat least one piece of information about intra prediction correspondingto the size of a previously encoded/decoded upper level block may beused.

When at least one of the pieces of intra prediction information isentropy-encoded/decoded, at least one of the following binarizationmethods may be used.

Truncated Rice binarization method

K-th order Exp_Golomb binarization method

Limited K-th order Exp_Golomb binarization method

Fixed-length binarization method

Unary binarization method

Truncated Unary binarization method

Now, a detailed description will be given of the reference sampleconstruction step S520.

In intra prediction of the current block or a sub-block having a smallersize and/or shape than the current block based on the derived intraprediction mode, a reference sample may be constructed for theprediction. The following description is given in the context of thecurrent block, and the current block may mean a sub-block. The referencesample may be constructed, using one or more reconstructed samples orsample combinations neighboring to the current block. Additionally,filtering may be applied in constructing the reference sample. Herein,the reference sample may be constructed using each reconstructed sampleon a plurality of reconstructed sample lines, as it is. Or, thereference sample may be constructed after filtering between samples onthe same reconstructed sample line. Or, the reference sample may beconstructed after filtering between samples on different reconstructedsample lines. The constructed reference sample may be denoted by ref[m,n], and a reconstructed neighbor sample or a sample obtained byfiltering the reconstructed neighbor sample may be denoted by rec[m, n].Herein, m or n may be a predetermined integer value. In the case wherethe current block is of size W(horizontal)×H(vertical), if a leftuppermost sample position of the current block is (0, 0), a relativeposition of a left uppermost reference sample closest to the sampleposition may be set to (−1, −1).

FIG. 10 is an exemplary view depicting neighbor reconstructed samplelines which may be used for intra prediction of a current block.

As illustrated in FIG. 10, a reference sample may be constructed usingone or more reconstructed sample lines adjacent to the current block.

For example, one of a plurality of reconstructed sample linesillustrated in FIG. 10 may be selected, and a reference sample may beconstructed using the selected reconstructed sample line. Apredetermined one of the plurality of reconstructed sample lines may befixedly selected as the selected reconstructed sample line. Or, aspecific one of the plurality of reconstructed sample lines may beadaptively selected as the selected reconstructed sample line. In thiscase, an indicator for the selected reconstructed sample line may besignaled.

For example, a reference sample may be constructed using one or more ofthe plurality of reconstructed sample lines illustrated in FIG. 10 incombination. For example, a reference sample may be constructed as aweighted sum (or weighted mean) of one or more reconstructed samples.Weights used for the weighted sum may be assigned based on distancesfrom the current block. Herein, a larger weight may be assigned for ashorter distance to the current block. For example, the following[Equation 1] may be used.

ref[−1, −1]=(rec[−2, −1]+2*rec[−1, −1]+rec[−1, −2]+2) >>2

ref[x, −1]=(rec[x, −2]+3*rec[x, −1]+2)>>2, (x=0˜W+H−1)

ref[−1, y]=(rec[−2, y]+3*rec[−1, y]+2)>>2, (y=0˜W+H−1)   [Equation 1]

Or, a reference sample may be constructed using at least one of the meanvalue, maximum value, minimum value, median value, and most frequentvalue of a plurality of reconstructed samples based on at least one ofdistances from the current block or intra prediction modes.

Or, a reference sample may be constructed based on a change (variation)in the values of a plurality of contiguous reconstructed samples. Forexample, a reference sample may be constructed based on at least one ofwhether the difference between the values of two contiguousreconstructed samples is equal to or larger than a threshold, whetherthe values of the two contiguous reconstructed samples are changedcontinuously or non-continuously, and so on. For example, if thedifference between rec[−1 , −1] and rec[−2, −1] is equal to or largerthan a threshold, ref[−1, −1] may be determined to be rec[−1, −1], or aW value obtained by applying a weighted mean with a predetermined weightassigned to rec[−1, −1]. For example, if as a plurality of contiguousreconstructed samples are nearer to the current bloc, the values of theplurality of contiguous reconstructed samples are changed by n eachtime, a reference sample, ref[−1, −1] may be determined to be rec[−1,−1]-n.

At least one among the number and positions of reconstructed samplelines and a constructing method used for constructing the referencesample may be determined differently according to whether an upper orleft boundary of the current block corresponds to a boundary of at leastone among a picture, a slice, a tile and a Coding Tree Block (CTB).

For example, in constructing a reference sample using reconstructedsample lines 1 and 2, when the upper boundary of the current blockcorresponds to a CTB boundary, reconstructed sample line 1 may be usedfor the upper side and reconstructed sample lines 1 and 2 may be usedfor the left side.

For example, in constructing a reference sample using reconstructedsample lines 1 to 4, when the upper boundary of the current blockcorresponds to a CTB boundary, reconstructed sample lines 1 and 2 may beused for the upper side and reconstructed sample lines 1 to 4 may beused for the left side.

For example, in constructing a reference sample using reconstructedsample line 2, when the upper boundary of the current block correspondsto a CTB boundary, reconstructed sample line 1 may be used for the upperside and reconstructed sample line 2 may be used for the left side.

One or more reference sample lines may be constructed through the aboveprocess.

A reference sample constructing method of the upper side of the currentblock may be different from that of the left side.

Information indicating that a reference sample has been constructedusing at least one method among the above methods may beencoded/decoded. For example, information indicating whether a pluralityof reconstructed sample lines are used may be encoded/decoded.

If the current block is divided into a plurality of sub-blocks, and eachsub-block has an independent intra prediction mode, a reference samplemay be constructed for each sub-block.

FIG. 11 is a view depicting an embodiment of constructing a referencesample for a sub-block included in a current block.

As illustrated in FIG. 11, if the current block is of size 16×16 and 164×4 sub-blocks have independent intra prediction modes, a referencesample for each sub-block may be constructed in at least one of thefollowing methods according to a scanning scheme for predicting asub-block.

For example, a reference sample may be constructed for each sub-block,using N reconstruction sample lines neighboring to the current block. Inthe example illustrated in FIG. 11, N is 1.

For example, in the case where a plurality of sub-blocks are predictedin a raster scan order of 1→2→3→. . . 15→16, a reference sample for aKth sub-block may be constructed, using a sample of at least one ofalready encoded/decoded lett, top, top right, and bottom leftsub-blocks.

For example, in the case where a plurality of sub-blocks are predictedin a Z scan order of 1→2→5→6→3→4→7→ . . . 12→15→16, a reference samplefor a Kth sub-block may be constructed, using a sample of at least oneof already encoded/decoded left, top, top right, and bottom leftsub-blocks.

For example, in the case where a plurality of sub-blocks are predictedin a zig-zag scan order of 1→2→5→9→6→3→4→ . . . 12→15→16, a referencesample for a Kth sub-block may be constructed, using a sample of atleast one of already encoded/decoded left, top, top right, and bottomleft sub-blocks.

For example, in the case where a plurality of sub-blocks are predictedin a vertical scan order of 1→5→9→13→2→6→ . . . 8→12→16, a referencesample for a Kth sub-block may be constructed, using a sample of atleast one of already encoded/decoded left, top, top right, and bottomleft sub-blocks.

In the case where a plurality of sub-blocks are predicted in a scanorder other than the above scan orders, a reference sample for a Kthsub-block may be constructed, using a sample of at least one of alreadyencoded/decoded left, top, top right, and bottom left sub-blocks.

In selecting the reference sample, a decision as to the availability ofa block including the reference sample and/or padding may be performed.For example, if the block including the reference sample is available,the reference sample may be used. Meanwhile, if the block including thereference sample is not available, the unavailable reference sample maybe replaced with one or more available neighbor reference samples bypadding.

If the reference sample exists outside at least one of a pictureboundary, a tile boundary, a slice boundary, a CTB boundary, and apredetermined boundary, it may be determined that the reference sampleis not available.

In the case where the current block is encoded by CIP (constrained intraprediction), if the block including the reference sample isencoded/decoded in an inter prediction mode, it may be determined thatthe reference sample is not available.

FIG. 12 is a view depicting a method for replacing an unavailablereconstructed sample, using an available reconstructed sample.

If it is determined that the neighbor reconstructed sample isunavailable, the unavailable sample may be replaced, using a neighboravailable reconstructed sample. For example, as illustrated in FIG. 12,in the presence of available samples and unavailable samples, anunavailable sample may be replaced, using one or more available samples.

The sample value of an unavailable sample may be replaced with thesample value of an available sample in a predetermined order. Anavailable sample adjacent to an unavailable sample may be used toreplace the unavailable sample. In the absence of an adjacent availablesample, the first appearing available sample or the closest availablesample may be used. A replacement order of unavailable samples may be aleft lowermost to right uppermost order. Or the replacement order ofunavailable samples may be a right uppermost to left lowermost order. Orthe replacement order of unavailable samples may be a left uppermost toright uppermost and/or left lowermost order. Or the replacement order ofunavailable samples may be a right uppermost and/or left lowermost toleft uppermost order.

As illustrated in FIG. 12, unavailable samples may be replaced in anorder from a left lowermost sample position 0 to a right uppermostsample. In this case, the values of the first four unavailable samplesmay be replaced with the value of the first appearing or closestavailable sample a. The values of the next 13 unavailable samples may bereplaced with the value of the last available sample b.

Or, an unavailable sample may be replaced, using a combination ofavailable samples. For example, the unavailable sample may be replacedusing the mean value of available samples adjacent to both ends of theunavailable sample. For example, in FIG. 12, the first four unavailablesamples may be filled with the value of the available sample a, and thenext 13 unavailable samples may be filled with the mean value of theavailable sample b and an available sample c. Or, the 13 unavailablesamples may be filled with any value between the values of the availablesamples b and c. In this case, the unavailable samples may be replacedwith difference values. For example, as an unavailable sample is nearerto the available sample a, the value of the unavailable sample may bereplaced with a value close to the value of the available sample a.Similarly, as an unavailable sample is nearer to the available sample b,the value of the unavailable sample may be replaced with a value closeto the value of the available sample b. That is, the value of anunavailable sample may be determined based on the distance from theunavailable sample to the available sample a and/or b.

To replace an unavailable sample, one or more of a plurality of methodsincluding the above methods may be selectively applied. A method forreplacing an unavailable sample may be signaled by information includedin a bitstream, or a method predetermined by an encoder and a decodermay be used. Or the method for replacing an unavailable sample may bederived by a predetermined scheme. For example, a method for replacingan unavailable sample may be selected based on the difference betweenthe values of the available samples a and b and/or the number ofunavailable samples. For example, a method for replacing an unavailablesample may be selected based on a comparison between the differencebetween the values of two available samples and a threshold and/or acomparison between the number of unavailable samples and a threshold.For example, if the difference between the values of the two availablesamples is larger than the threshold and/or if the number of unavailablesamples is larger than the threshold, the values of unavailable samplesmay be replaced with different values.

For the constructed one or more reference samples, it may be determinedwhether to apply filtering according to at least one of the intraprediction mode, size, and shape of the current block. If the filteringis applied, a different filter type may be used according to at leastone of the intra prediction mode, size, and shape of the current block.

For example, for each of the plurality of reference sample lines,whether filtering is applied and/or a filter type may be determineddifferently. For example, filtering may be applied to a first neighborline, whereas filtering may not be applied to a second neighbor line.For example, both a filtered value and a non-filtered value may be usedfor the reference sample. For example, among 3-tap filter, 5-tap filterand 7-tap filter, at least one may be selected and applied according toat least intra prediction mode, size and shape of a block.

Hereinbelow, the step of performing intra prediction (S530) will bedescribed in detail.

Intra prediction may be performed for the current block or a sub-blockbased on the derived intra prediction mode and reference sample. In thefollowing description, the current block may mean a sub-block.

For example, non-directional intra prediction may be performed. Thenon-directional intra prediction mode may be at least one of the DC modeand the Planar mode.

Intra prediction in the DC mode may be performed using the mean value ofone or more of the constructed reference samples. Filtering may beapplied to one or more prediction samples at the boundary of the currentblock. The DC-mode intra prediction may be performed adaptivelyaccording to at least one of the size and shape of the current block.

FIG. 13 is an exemplary view illustrating intra prediction according toshapes of a current block.

For example, as illustrated in (a) of FIG. 13, if the current block isshaped into a square, the current block may be predicted using the meanvalue of reference samples above and to the left of the current block.

For example, as illustrated in (b) of FIG. 13, if the current block isshaped into a rectangle, the current block may be predicted using themean value of reference samples neighboring to the longer between thewidth and length of the current block.

For example, if the size of the current block falls within apredetermined range, predetermined samples are selected from among thetop or left reference samples of i the current block, and prediction maybe performed using the mean value of the selected samples.

Planar-mode intra prediction may be performed by calculating a weightedsum in consideration of distances from the one or more constructedreference samples according to the positions of target intra predictionsamples of the current block.

For example, a prediction block may be calculated to be a weighted sumof N reference samples dependent on the position (x, y) of a targetprediction sample. N may be a positive integer, for example, 4.

For example, directional intra prediction may be performed. Thedirectional prediction mode may be at least one of a horizontal mode, avertical mode, and a mode having a predetermined angle.

Horizontal/vertical-mode intra prediction may be performed using one ormore reference samples on a horizontal/vertical line at the position ofa target intra prediction sample.

Intra prediction in a mode having a predetermined angle may be performedusing one or more reference samples on a line at the predetermined anglewith respect to the position of a target intra prediction sample.Herein, N reference samples may be used. N may be a positive integersuch as 2, 3, 4, 5, or 6. Further, for example, prediction may beperformed by applying an N-tap filter such as a 2-tap, 3-tap, 4-tap,5-tap, or 6-tap filter.

For example, intra prediction may be performed based on positioninformation. The position information may be encoded/decoded, and areconstruction sample block at the position may be derived as an intraprediction block for the current block. Or a block similar to thecurrent block, detected by the decoder may be derived as an intraprediction block for the current block.

For example, an intra color component prediction may be performed. Forexample, intra prediction may be performed for a chroma component usinga reconstruction luma component of the current block. Or, intraprediction may be performed for another chroma component Cr using onereconstruction chroma component Cb of the current block.

Intra prediction may be performed by using one or more of theafore-described various intra prediction methods in combination. Forexample, an intra prediction block may be constructed for the currentblock through a weighted sum of a block predicted using a predeterminednon-directional intra prediction mode and a block predicted using apredetermined directional intra prediction mode. Herein, a differentweight may be applied according to at least one of the intra predictionmode, block size, shape/and or sample position of the current block.

The above embodiments may be performed in the same method in an encoderand a decoder.

A sequence of applying to above embodiment may be different between anencoder and a decoder, or the sequence applying to above embodiment maybe the same in the encoder and the decoder,

The above embodiment may be performed on each luma signal and chromasignal, or the above embodiment may be identically performed on luma andchroma signals.

A block form to which the above embodiments of the present invention areapplied may have a square form or a non-square form.

The above embodiment of the present invention may be applied dependingon a size of at least one of a coding block, a prediction block, atransform block, a block, a current block, a coding unit, a predictionunit, a transform unit, a unit, and a current unit. Herein, the size maybe defined as a minimum size or maximum size or both so that the aboveembodiments are applied, or may be defined as a fixed size to which theabove embodiment is applied. In addition, in the above embodiments, afirst embodiment may be applied to a first size, and a second embodimentmay be applied to a second size. In other words, the above embodimentsmay be applied in combination depending on a size. In addition, theabove embodiments may be applied when a size is equal to or greater thata minimum size and equal to or smaller than a maximum size. In otherwords, the above embodiments may be applied when a block size isincluded within a certain range.

For example, the above embodiments may be applied when a size of currentblock is 8×8 or greater. For example, the above embodiments may beapplied when a size of current block is 4×4 or greater. For example, theabove embodiments may be applied when a size of current block is 16×16or smaller. For example, the above embodiments may be applied when asize of current block is equal to or greater than 16×16 and equal to orsmaller than 64×64.

The above embodiments of the present invention may be applied dependingon a temporal layer. In order to identify a temporal layer to which theabove embodiments may be applied, an additional identifier may besignaled, and the above embodiments may be applied to a specifiedtemporal layer identified by the corresponding identifier. Herein, theidentifier may be defined as the lowest layer or the highest layer orboth to which the above embodiment may be applied, or may be defined toindicate a specific layer to which the embodiment is applied. Inaddition, a fixed temporal layer to which the embodiment is applied maybe defined.

For example, the above embodiments may be applied when a temporal layerof a current image is the lowest layer. For example, the aboveembodiments may be applied when a temporal layer identifier of a currentimage is 1. For example, the above embodiments may be applied when atemporal layer of a current image is the highest layer.

A slice type to which the above embodiments of the present invention areapplied may be defined, and the above embodiments may be applieddepending on the corresponding slice type.

In the above-described embodiments, the methods are described based onthe flowcharts with a series of steps or units, but the presentinvention is not limited to the order of the steps, and rather, somesteps may be performed simultaneously or in different order with othersteps. In addition, it should be appreciated by one of ordinary skill inthe art that the steps in the flowcharts do not exclude each other andthat other steps may be added to the flowcharts or some of the steps maybe deleted from the flowcharts without influencing the scope of thepresent invention.

The embodiments include various aspects of examples. All possiblecombinations for various aspects may not be described, but those skilledin the art will be able to recognize different combinations,Accordingly, the present invention may include all replacements,modifications, and changes within the scope of the claims.

The embodiments of the present invention may be implemented in a form ofprogram instructions, which are executable by various computercomponents, and recorded in a computer-readable recording medium. Thecomputer-readable recording medium may include stand-alone or acombination of program instructions, data files, data structures, etc.The program instructions recorded in the computer-readable recordingmedium may be specially designed and constructed for the presentinvention, or well-known to a person of ordinary skilled in computersoftware technology field. Examples of the computer-readable recordingmedium include magnetic recording media such as hard disks, floppydisks, and magnetic tapes; optical data storage media such as CD-ROMs orDVD-ROMs; magneto-optimum media such as floptical disks; and hardwaredevices, such as Is read-only memory (ROM), random-access memory (RAM),flash memory, etc., which are particularly structured to store andimplement the program instruction. Examples of the program instructionsinclude not only a mechanical language code formatted by a compiler butalso a high level language code that may be implemented by a computerusing an interpreter. The hardware devices may be configured to beoperated by one or more software modules or vice versa to conduct theprocesses according to the present invention.

Although the present invention has been described in terms of specificitems such as detailed elements as well as the limited embodiments andthe drawings, they are only provided to help more general understandingof the invention, and the present invention is not limited to the aboveembodiments. It will be appreciated by those skilled in the art to whichthe present invention pertains that various modifications and changesmay be made from the above description.

Therefore, the spirit of the present invention shall not be limited tothe above-described embodiments, and the entire scope of the appendedclaims and their equivalents will fall within the scope and spirit ofthe invention.

INDUSTRIAL APPLICABILITY

The present invention may be used in encoding/decoding an image.

1. An image decoding method performed by an image decoding apparatus,comprising: decoding first MPM information indicating whether a planarmode in a first MPM list is applied to a current block; deriving anintra prediction mode of the current block to be the planar mode inresponse to the first MPM information indicating that the planar mode inthe first MPM list is applied to the current block; to decoding secondMPM information indicating the intra prediction mode of the currentblock in a second MPM list in response to the first MPM informationindicating that the planar mode in the first MPM list is not applied tothe current block, and deriving the intra prediction mode of the currentblock in the second MPM list based on the second MPM information;configuring a reference sample for intra prediction of the currentblock; obtaining prediction samples of the current block based on theintra prediction mode and the reference sample, obtaining residualsamples of the current block; and generating reconstructed samples ofthe current block by adding the prediction samples and the residualsamples of the current block, wherein the second MPM list comprises afirst intra prediction mode of a neighboring block of the current blockand a second intra prediction mode having an index that is greater thanor smaller than an index of the first intra prediction mode, and whereinan offset between indexes of the first intra prediction mode and thesecond intra prediction mode is greater than or equal to
 2. 2. Themethod of claim 1, wherein the deriving the intra prediction mode of thecurrent block comprises: selecting one MPM list among a plurality of MPMlists in case the intra prediction mode of the current block isdetermined to be included in the MPM list; and deriving the intraprediction mode of the current block from the selected MPM list.
 3. Themethod of claim 1, wherein the first MPM list has fewer MPM candidatesthan the second MPM list.
 4. The method of claim 1, wherein the MPM listcomprises DC mode in case to the intra prediction mode of theneighboring block is a non-directional mode.
 5. The method of claim 1,wherein the configuring the reference sample is performed based on areconstructed sample line selected among a plurality of reconstructedsample lines based on information signaled through a bitstream.
 6. Themethod of claim 5, wherein the configuring the reference sample isperformed based on a first reconstructed sample line among the pluralityof reconstructed sample lines in case an upper boundary of the currentblock is a boundary of a coding tree block(CTB).
 7. The method of claim5, wherein the configuring the reference sample further comprisesfiltering the selected reconstructed sample line, and wherein thefiltering is performed only when a first reconstructed sample line isselected.
 8. The method of claim 1, wherein, in case the intraprediction mode of the current block is a DC mode and a width of thecurrent block is not equal to a height of the current block, theprediction samples of the current block are obtained by using an averageof reference samples adjacent to longer side among the width and theheight of the current block.
 9. An image encoding method performed by animage encoding apparatus, the method comprising: determining an intraprediction mode of a current block; configuring a reference sample forintra prediction of the current block; obtaining prediction samples ofthe current block based on the intra prediction mode and the referencesample; obtaining residual samples of the current block by using theprediction samples of the current block; is encoding first MPMinformation based on the intra prediction mode of the current block, thefirst MPM information indicating whether a planar mode in a first MPMlist is applied to the current block; encoding second MPM informationbased on the intra prediction mode of the current block in response tothe first MPM information indicating that the planar mode in the firstMPM list is not applied to the current block, the second MPM informationindicating the intra prediction mode of the current block in a secondMPM list; and encoding the residual samples of the current block,wherein the second MPM list comprises a first intra prediction mode of aneighboring block of the current block and a second intra predictionmode having an index that is greater than or smaller than an index ofthe first intra prediction mode, and wherein an offset between indexesof the first intra prediction mode and the second intra prediction modeis greater than or equal to
 2. 10. The method of claim 9, wherein thedetermining the intra prediction mode of the current block comprises:selecting one MPM list to which the intra prediction mode of the currentblock among a plurality of MPM lists in case the intra prediction modeof the current block is determined to be included in the MPM list; anddetermining the intra prediction mode of the current block based on theselected MPM list.
 11. The method of claim 9, wherein the first MPM listhas fewer MPM candidates than the second MPM list.
 12. The method ofclaim 9, wherein the MPM list comprises DC mode in case the intraprediction mode of the neighboring block is a non-directional mode. 13.The method of claim 9, wherein the configuring the reference sample isperformed based on a reconstructed sample line selected among aplurality of reconstructed sample lines, and information on theselection of the reconstructed sample line is encoded into a bitstream.14. The method of claim 13, wherein the configuring the reference sampleis performed based on a first reconstructed sample line among theplurality of reconstructed sample lines in case an upper boundary of thecurrent block is a boundary of a coding tree block(CTB).
 15. The methodof claim 13, wherein the configuring the reference sample furthercomprises filtering the selected reconstructed sample line, and thefiltering is performed only when a first reconstructed sample line isselected.
 16. The method of claim 9, wherein, in case that the intraprediction mode of the current block is a DC mode and a width of thecurrent block is not equal to a height of the current block, theprediction samples of the current block are obtained by using an averageof reference samples adjacent to longer side among the width and theheight of the current block.
 17. A non-transitory computer-readablerecording medium storing a bitstream which is generated by an imageencoding method, the image encoding method comprising: determining anintra prediction mode of a current block; configuring a reference samplefor intra prediction of the current block; obtaining prediction samplesof the current block based on the intra prediction mode and thereference sample; obtaining residual samples of the current block byusing the prediction samples of the current block; encoding first MPMinformation based on the intra prediction mode of the current block, thefirst MPM information indicating whether a planar mode in a first MPMlist is applied to the current block; encoding second MPM informationbased on the intra prediction mode of the current block in response tothe first MPM information indicating that the planar mode in the firstMPM list is not applied to the current block, the second MPM informationindicating the intra prediction mode of the current block in a secondMPM list; and encoding the residual samples of the current block,wherein the second MPM list comprises a first intra prediction mode of aneighboring block of the current block and a second intra predictionmode having an index that is greater than or smaller than an index ofthe first intra prediction mode, and wherein an offset between indexesof the first intra prediction mode and the second intra prediction modeis greater than or equal to 2.